Boost logo

Boost Users :

From: Alexander Terekhov (yg-boost-users_at_[hidden])
Date: 2003-05-14 10:28:47


"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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net