Search code examples
c++multithreadinglockingmutexstandard-library

What are the advantages of other mutex wrapper libraries over std::mutex?


The C++ standard library offers std::mutex (lock, unlock, try_lock) functionality, that can work within a multi-threaded environment.

Also I have heard talk about wrapper libraries (e.g. Boost::mutex) that provide, from what I can see, the same functionality (lock, unlock, try_lock).

My question is, what is the advantage of using such wrapper libraries over the standard one?


Solution

  • std::mutex, std::thread and other elements of the threading library are only available C++11. boost::mutex et al predate C++11. So the advantage is that you can use them if you don't have C++11 support.