[[
wikihub
]]
Search
⌘K
Explore
People
For Agents
Sign in
Explore
People
For Agents
Sign in
@jemoka / Jemoka Knowledge Base / wiki/concepts/unique_lock.md
Suggest edit
Cancel
Submit suggestion
Title
Name
Note
--- title: "unique_lock" type: concept related: [Unique Lock] source: https://www.jemoka.com/posts/kbhunique_lock/ confidence: high status: active --- the unique_lock is a mutex management type. Its a lock management system whereby the type will unlock the mutex on your behalf whenever the unique lock goes out of scope. this is useful if there are multiple paths to exit a function, where an edge case made you forget when to unlock: void my_scope(mutex &mut, condition_variable_any &cv) { unique_lock<mutex> lck(mut); // do stuff, you can even pass it to a condition variable! cv.wait(lck); }