/** * @brief Constructs a unique_lock from a Mutex and tries to lock it. */ inline unique_lock(mutex_type& mtx, try_to_lock_t) : m_mtx{&mtx}, m_owns{mtx.try_lock()} {}
explicit unique_lock(mutex_type& m) : mutex_ptr_(&m), owns_(false) { m.lock(); owns_ = true; }
/** * Constructor from a mutex reference. * * @param mtx the mutex to lock. * * __Effects: Stores a reference to the mutex to lock and locks it. * __Throws: Any exception BasicMutex::lock() can throw. */ explicit strict_lock(mutex_type& mtx) : mtx_(mtx) { mtx.lock(); } /*< locks on construction >*/
explicit lock_guard(mutex_type & mtx) : mutex_(mtx) { mtx.lock(); }