std::unique_lock in C++ — defer_lock, try_to_lock, and Why Condition Variables Need It

More flexible than lock_guard: unlock mid-scope, defer locking, try once, and the one wrapper condition_variable requires.