PThread, BOOST:Thread and C++11 Thread comparison

Where can you use multithreading/concurrency library provided by BOOST, C++11 STL and Pthread? What would be the different scenarios and need where these libraries would be used for different tasks? Can these libraries be used interchangeably or not?
Sounds like homework.
No its not homework I am just trying to figure out which way to go I am familiar with std::thread/mutex/future/atomic and trying to figure out which way to go. And I request you to only reply when you know a solution or an answer.
"Sounds like homework" doesn't help and you waste your own time.
Thank you.
AFAIK C++ STL and Boost threads are largely interchangable, since the STL thread lib was heavily based on Boost threads.

Boost has a bit more functionality, though, like the ability to forcefully kill threads (STL does not offer a way to do that because it raises resource leak concerns).

pthread from my limited experience of it is very functional, but extremely clunky to use, as it is a primarily C lib and therefore can't take advantage of RAII concepts or functors for callbacks and other goodies that both Boost and STL are loaded with.



Personally, I use STL threads pretty much exclusively. Making use of standard libs when you can is just generally sound practice. The only time I would recommend something other than STL would be if STL is lacking some key functionality that you require -- in which case Boost would very likely have you covered, and would be my #2 go to.

I don't ever want to touch pthread again.



EDIT:

As for where they can all be used -- beats me. Obviously STL threads can't be an option on systems where that lib is not available.

If this is a concern, then you'll have to research all the targets you want to support up front and see which libs are available there.
Last edited on
Topic archived. No new replies allowed.