C++ Language/Std/Multithreading/Locks

The mutually exclusive execution property of a critical section is provided by a "lock" synchronization primitive (type std::mutex with functions lock() and unlock()). The lock maintains a record of which thread called lock(), and only that "owner-thread" is allowed to call unlock().

Additional information about locks (includes interactive examples)