I try to get rid of some of the boost dependencies in my code and instead use the new C++11 features (Visual Studio 2013).
In one of my components I used boost::mutex
together with boost::lock_guard<boost::mutex>
and everything worked fine. When I use std::mutex
together with std::lock_guard<std::mutex>
instead, I get the following error when returning from main()
.
Unhandled exception at 0x7721E3BE (ntdll.dll) in GrabberTester.exe: 0xC0000005: Access violation reading location 0xA6A6B491.
The real project is quite complex and it's therefore difficult to provide a full working code example to reproduce this problem. In my real project the mutexes are used in a shared library which is loaded at runtime (but which should already be unloaded by the time I'm returning from main()
.
My questions are:
- Are
boost::mutex
andstd::mutex
designed to behave absolutely the same? - If not, what are the differences? What do I need to keep in mind when using
std::mutex
instead ofboost::mutex
? - In the shared library I'm creating threads with the
boost::thread
framework. Could it be thatstd::mutex
can only be used withstd::thread
s and is incompatible withboost::thread
s?
Aucun commentaire:
Enregistrer un commentaire