cpp/thread/mutex

The class is a synchronization primitive that can be used to protect shared data from being simultaneously accessed by multiple threads.

offers exclusive, non-recursive ownership semantics:


 * A calling thread owns a from the time that it successfully calls either cpp/thread/mutex/lock or cpp/thread/mutex/try_lock until it calls cpp/thread/mutex/unlock.
 * When a thread owns a, all other threads will block (for calls to cpp/thread/mutex/lock) or receive a return value (for cpp/thread/mutex/try_lock) if they attempt to claim ownership of the.
 * A calling thread must not own the prior to calling cpp/thread/mutex/lock or cpp/thread/mutex/try_lock.

The behavior of a program is undefined if a is destroyed while still owned by any threads, or a thread terminates while owning a. The class satisfies all requirements of  and.

is neither copyable nor movable.