liveBook · Manning

Unique_lock

std::unique_lock is a C++ standard library class template that manages exclusive ownership of a mutex and supports deferred locking, unlocking, and ownership transfer.

How 2 Manning books explain it

Object-Oriented Software Design in C++

A C++ standard library lock-management class that provides exclusive ownership of a mutex and releases that ownership automatically when the lock object is destroyed.

How it is used
Coordinates exclusive access to shared resources and supplies the lock object required by condition-variable waits.
How deep it goes
Explains construction, scope-based unlocking, reader-writer behavior, and condition-variable waiting, without detailing the class implementation.
Examples
Uses technician and logger threads sharing a meter, plus producer and consumer threads sharing a bounded queue.
What you can do after
Apply it via C++ mutexes and condition variables to guard critical regions and synchronize access to shared data.

Read how Object-Oriented Software Design in C++ explains unique_lock →

C++ Concurrency in Action, Second Edition

`std::unique_lock` is a C++ standard library class template that manages ownership of a mutex lock and supports deferred locking, unlocking, and ownership transfer.

How it is used
Manages mutex ownership when locking must be deferred, released, or transferred between scopes.
How deep it goes
Explains deferred acquisition, ownership tracking, destructor behavior, move transfer, and costs without enumerating the full API.
Examples
Uses a two-mutex swap, a lock-returning data-preparation function, and exclusive updates with shared_mutex.
What you can do after
Apply deferred locking to acquire multiple mutexes safely or transfer a held lock to a caller.

Read how C++ Concurrency in Action, Second Edition explains unique_lock →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.