From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-08-25 16:06:41


Yuval Ronen:

> Peter Dimov wrote:
>> Yuval Ronen:
>>
>>> Checking in runtime is enough, IMO.
>>
>> How do you suggest this runtime checking be implemented?
>
> assert(m_mutex.locked());

Well... this implies that a condition is always associated with a mutex and
that the Mutex concept provides a locked() query, which it currently does
not.

In principle one may check for a try_lock failure, although this doesn't
tell us which thread has locked the mutex.

Given that you already have a lock variable at the point you are calling
wait, what's wrong with just passing it?