Nana C++ Library  

An open-source C++ framework project
The Programmer's Guide 
nana::threads::unique_lock<typename Mutex>

Description

The class lock_guard maintains the ownership of a mutex object through the lock_guard's object lifetime.

Model of

None

Public base classes

None

Template Parameters

Mutex The type of a mutex object.

Typedefs

mutex_type The alias type of Mutex.

Members

unique_lock() The construction.
explicit unique_lock(menu_type& m) Locks the mutex. If the mutex object is a non-recursive mutex, it might throw a std::runtime_error if the mutex is obtained the ownership.
~unique_lock() Unlocks the mutex if it owns.
void lock() Locks the mutex.
bool try_lock() Attempts to obtain the ownership without blocking. If ownership is not obtained, it returns false.
bool try_lock_for(std::size_t milliseconds) Attempts to obtain the ownership. It returns false, the waiting is timed out.
void unlock() Unlocks the mutex.
void swap(unique_lock& u) throw() Swaps two locks.
mutex_type * release() throw() Detachs the mutex and returns the address of previous mutex object.
operator bool() const throw() Returns true if it owns the ownership of the mutex.
mutex_type * mutex() const throw() Returns the address of mutex object.

File

nana/threads/mutex.hpp

Notes

None.

See also

None.


Move to The Nana Programmer's Guide Main Page