What's the difference between boost::signals2::mutex and boost::thread::mutex?

634 views Asked by At

I'm using scoped_lock and mutex to implement a version of a BlockingQueue posted in a different SO question, but there are multiple different precompiled headers for both of them in boost.

scoped_lock is available through "boost/interprocessor/sync/scoped_lock.hpp" and "boost/thread/mutex.hpp"

mutex is available through "boost/thread/mutex.hpp", "boost/signals2/mutex.hpp" and "boost/thread/win32/mutex.hpp"

I can guess that the "win32/mutex.hpp" is somehow optimized for windows, but what about the others? What's the difference between them?

1

There are 1 answers

1
edA-qa mort-ora-y On BEST ANSWER

The signals2::mutex is part of the signals2 library, thus presumably a special purpose mutex just for that library.

The generic mutex is the "boost/thread/mutex.hpp" one and should be the one you use. The "win32" version will be included automatically by the generic file and includes the code for mutexes on windows. That is, the generic header is a wrapper for the OS specific classes.