
14 May
2003
14 May
'03
3:28 p.m.
"William E. Kempf" wrote: [...]
means short blocks, even if artificial. Short code blocks combined with the need to carefully analyze synchronization leads to little chance of making the mistake you illustrate.
But explicit unlocking (also "RAII" based) sometimes IS "needed". http://terekhov.de/DESIGN-futex-CV.cpp ~futex_condvar() { mutex::guard guard( m_mutex ); assert( m_waiters[0] == m_wakeups ); while ( m_waiters[0] ) { int ftx = m_futex = EOC(); mutex::release_guard release_guard( guard ); cancel_off_guard no_cancel; m_futex.wait( ftx ); } } regards, alexander.