Boost logo

Boost :

From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2008-02-07 05:33:29

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.


Boost list run by bdawes at, gregod at, cpdaniel at, john at