C++ Libraries/unique lock methods

From Software Engineers Wiki
Jump to: navigation, search

Simple locking/unlocking

  • lock() : locks the associated mutex. it calls mutex()->lock(). If the mutex is already locked by the same unique_lock, throws an exception to avoid dead lock.
  • unlock() : unlocks the associated mutex

try_lock variation

  • try_lock() : tries to lock the associated mutex without blocking.
  • try_lock_for(timeout_duration) : trie to lock the associated mutex. the caller is blocked until the lock is acquired, or the duration has elapsed.
  • try_lock_until(timeout_time) : tries to lock the associated mutex. the caller is blocked until the lock is acquired, or specified time has been reached.
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox