
14 Nov
2007
14 Nov
'07
12:45 p.m.
"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.