Boost logo

Threads-Devel :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-03-02 11:24:09


Anthony Williams wrote:

> I'm not proposing anything --- this needs more thought. I thought that was
>
>your suggestion, anyway.
>
>
Thats true, sorry.

>I'm just pointing out that on Windows, it is legal to destroy a locked
>mutex.
>
Are you sure? I tried to find something about this in the documentation,
but nothing found.

> Whether or not doing so constitutes a bug in the application is another
>matter --- I suspect that it is in most cases.
>
>
Hmm, lets assume thread A locked the mutex M.
Now thread B CloseHandle(M).
Futher assume A does not access the object that is
protected by M (altough unlikely).
Now how can thread A ever release the Lock?
The CloseHandle was succesful, so it isn't accesible
any more except thread A is holding a duplicate of M
obtained by handle dup or such.

>I would want it to be illegal to destroy a boost::mutex if a lock is held, and
>for the implementation to detect this, if possible.
>
>
Here we agree I think.
Do you have an idea how this could be achieved?

Roland


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk