Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2004-10-25 08:41:54

While making use of mutex objects, namely in the wait function I found
out that I may not destroy a mutex while a thread is waiting for it to
become signalled.
On windows this results in undefined behaviour and with pthreads this
raises an assertion (in debug build).

I am aware that this could be solved by using an additional "aborted"
variable that could be tested in the while loop of the cond.wait(lk)
call, but I cannot see a straightforward way how to test abortion when
waiting in a try to simply lock such a mutex.

So I raise the question if it would be desirable to have the mutex
"throw exceptions to all threads" that are waiting for it when it is to
be destroyed? Does anyone have another idea of how to deal with this
situation properly?


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