3

Sometimes I read about (if I'm not interpreting wrong) that posix threads are not available or valid on sone platforms such as some RTOSs which inplements their own threading mechanism.

So, is posix thread can be considered as standard (at least on general purpose OS)? And is it platform independent?

2 Answers 2

4

"So, is posix thread can be considered as standard (at least on general purpose OS)?"

No, it's not standard for OS's that POSIX threads are supported.

I'd say that std::thread implementations rely on some POSIX thread commonly defined features.

Embedded Linux platforms are POSIX compatible of course, and you can rely on pthreads.

Windows platforms (counting as a general purpose OS) for instance, doesn't support POSIX threads natively, but there are wrapper APIs available with e.g. MinGW or cygwin.

"that posix threads are not available or valid on sone platforms such as some RTOSs which inplements their own threading mechanism."

Other embedded platforms like FreeRTOS don't support that threading model directly, but are eligible to write a POSIX wrapper.

The basic thread semantics could be usually wrapped well for the POSIX standard requirements, and injected to newlib or whatever you like to use as binding for realising the standards implementation.

Sign up to request clarification or add additional context in comments.

14 Comments

It is not an answer to the qeustion.
@VladfromMoscow You're falling back to your old revenge downvoting patterns. I'm a bit tired of you.
Where do you see a revenge? In my opinion this answer does not deserve to be the best. The other answer in this thread is better. I am ready to discuss the question.
@VladfromMoscow "here do you see a revenge?" It's a pattern in your behaviour, and I've seen that earlier (I even believe, you've been already banned for that earlier this year).
It is funny to see that you think that you are untouchable. I was ready to discuss the question but it seems you do not want to do this. I am sorry.
|
3

POSIX, the standard that specifies pthread, is a standard (Actually, more a group of standards) defining operating system behavior and functions. An OS either implements the standard or it doesn't. The goal of POSIX is platform independence, all the same OS calls on all platforms, but as with all standards, folks bolts stuff onto the edges to get extra functionality that is not portable or leave stuff out when it becomes problematic.

Linux implements POSIX fairly closely (but not even all families of Linux agree on how closely) so your concern will be with compatibility edge cases that I hope will be well documented at this point.

Windows POSIX support is somewhere below weak so you cannot count on it on general purpose OSes.

I recommend a quick search here on SO, Google or giving Wikipedia a look-over for a better description of POSIX.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.