
7 Feb
2008
7 Feb
'08
10:33 a.m.
Clark Sims wrote:
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.
boost::mutex foo; boost::mutex::scoped_lock lock1(foo); boost::mutex::scoped_lock lock2(foo);
Boost.Threads provides recursive_mutex, which is recursive, and mutex, which has unspecified behaviour if locked multiple times by the same thread. It looks as if this unspecified behaviour is actually different on those two platforms. If you want consistent behaviour you need to use recursive_mutex. Phil.