Skip to content
  • Pieter Wuille's avatar
    Locking system overhaul, add condition variables · 712fd182
    Pieter Wuille authored
    This commit simplifies the locking system: CCriticalSection becomes a
    simple typedef for boost::interprocess::interprocess_recursive_mutex,
    and CCriticalBlock and CTryCriticalBlock are replaced by a templated
    CMutexLock, which wraps boost::interprocess::scoped_lock.
    
    By making the lock type a template parameter, some critical sections
    can now be changed to non-recursive locks, which support waiting via
    condition variables. These are implemented in CWaitableCriticalSection
    and WAITABLE_CRITICAL_BLOCK.
    
    CWaitableCriticalSection is a wrapper for a different Boost mutex,
    which supports waiting/notification via condition variables. This
    should enable us to remove much of the used polling code. Important
    is that this mutex is not recursive, so functions that perform the
    locking must not call eachother.
    
    Because boost::interprocess::scoped_lock does not support assigning
    and copying, I had to revert to the older CRITICAL_BLOCK macros that
    use a nested for loop instead of a simple if.
    712fd182