From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2007-11-14 07:45:02


"Preston A. Elder" wrote:
[...]
> IF (!interruption_enabled)
> cond.wait(lock);
> ELSE
> interruption_checker check(cond);
> lock.unlock();
> lock.internal_lock.lock();
> cond.wait(lock.internal_lock);
> lock.internal_lock.unlock();
> if (check.interrupted)
> throw thread_interrupted;
> lock.lock(); // uses the above mutex::lock(), so interruptable.
>
> This way the condition still has the same interruption semantics as you

This is broken condition variable. It doesn't ensure "atomic" release
of a lock and blocking the calling thread ("atomic" with respect to
locking that same lock by another thread and then signaling condition
variable).

regards,
alexander.