
22 Feb
2013
22 Feb
'13
3:45 a.m.
AMDG On 02/21/2013 05:22 PM, Jeff Dunlap wrote:
I plan to start using Boost Thread, but for now I have a multithreaded Win32 application that does not use boost.
Although the threads were not created with Boost Thread, can I use boost::mutex::scoped_lock to protect some new functions I write for the app?
Yes. Synchronization primitives should work on any thread regardless of whether it was started using Boost.Thread or not. (I should point out that the main thread is never started by Boost.Thread, so this /has/ to work.)
Example:
boost::mutex mutex;
void whatever() { boost::mutex::scoped_lock lock(mutex); // will this be protected even though the // thread was not created using Boost? }
In Christ, Steven Watanabe