|
Boost : |
From: Pete (pete_at_[hidden])
Date: 2003-12-17 14:52:52
Running the following bit of code under WinXPPro prints:
Acquired first lock on mtxTest
Acquired second lock on mtxTest
and exits.
Under Linux RH9, it prints:
Acquired first lock on mtxTest
and deadlocks.
To me, the Linux behaviour makes perfect sense. Why doesn't it behave in the
same way under Windows?
#include <boost/thread/thread.hpp>
#include <iostream.h>
int main(int argc, char * argv[])
{
boost::mutex mtxTest;
// Initialise a scope to test scoped locking
{
boost::mutex::scoped_lock lock1(mtxTest);
cout << "Acquired first lock on mtxTest" << endl;
boost::mutex::scoped_lock lock2(mtxTest);
cout << "Acquired second lock on mtxTest" << endl;
}
return 0;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk