Header Reference: <mutex>
Header Reference: <mutex>
Mutex types, lock wrappers, and generic lock coordination helpers provided by <mutex>.
Header Reference: <mutex>
Mutex types, lock wrappers, and generic lock coordination helpers provided by <mutex>.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
Header reference pages are meant to answer a practical question quickly: what this header provides, when to reach for it, and which usage rules are easiest to get wrong.
<mutex>std::mutexstd::recursive_mutexstd::timed_mutexstd::recursive_timed_mutexstd::lock_guardstd::unique_lockstd::scoped_lockstd::lockstd::try_lockUse <mutex> for basic mutual exclusion and RAII lock management around shared invariants.
std::mutex and std::lock_guardstd::unique_lock when deferred locking, unlock/relock, or condition-variable waits are neededstd::scoped_lock or std::lock#include <mutex>
int main() {
std::mutex guard;
std::scoped_lock lock(guard);
return 0;
}