Skip to content

Glossary: C++ Beyond the Basics

Lock guard

Also written: std::lock_guard, lock_guard

`std::lock_guard` locks a mutex when created and unlocks it when destroyed, so an exception can't leave it locked.

Where the book teaches it

Related terms

Mutexstd::scoped_lockstd::unique_lock