Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-04-28 12:53:29

Michael Glassford wrote:


I'll think about your suggestion a bit more before I'll be able to comment,
but just a quick note:

> l = m.lock();
> //Lock mutex m (first unlocking whatever mutex l was previously
> locking, if any)

This is not what will happen. m.lock() is executed first, then operator= is
called and l is given the opportunity to release its lock. So if l happens
to already hold m.lock(), the thread will deadlock. (And a deadlock can also
occur if another thread holds a lock on m and is blocked on the mutex
currently locked by l.)

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