|
Boost : |
From: Clark Sims (clark_sims_boost_at_[hidden])
Date: 2008-02-06 23:22:02
I would like it to deadlock on windows, because I just wrote a large header file, which assumes that a deadlock will occur. In fact, I don't know how I am going to program mutex's and locks, if they act like recursive locks on windows, but scoped locks on linux.
#include <boost/thread/thread.hpp>
#include <iostream>
using namespace std;
void hello()
{
cerr << "this should deadlock" << endl;
boost::mutex foo;
boost::mutex::scoped_lock lock1(foo);
boost::mutex::scoped_lock lock2(foo);
cerr << "if you see this, then there was no deadlock" << endl;
}
int main(int argc, char* argv[])
{
boost::thread thrd(&hello);
thrd.join();
return 0;
}
---------------------------------
Never miss a thing. Make Yahoo your homepage.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk