Exemplo n.º 1
0
 /**
  * @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()} {}
Exemplo n.º 2
0
			explicit unique_lock(mutex_type& m)
				: mutex_ptr_(&m), owns_(false)
			{
				m.lock();
				owns_ = true;
			}
Exemplo n.º 3
0
 /**
  * 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 >*/
Exemplo n.º 4
0
			explicit lock_guard(mutex_type & mtx)
				: mutex_(mtx)
			{
				mtx.lock();
			}