mirror of
https://github.com/boostorg/thread.git
synced 2026-02-22 03:42:07 +00:00
129 lines
4.3 KiB
Plaintext
129 lines
4.3 KiB
Plaintext
[section:mutex_types Mutex Types]
|
|
|
|
[section:mutex Class `mutex`]
|
|
|
|
class mutex:
|
|
boost::noncopyable
|
|
{
|
|
public:
|
|
mutex();
|
|
~mutex();
|
|
|
|
void lock();
|
|
bool try_lock();
|
|
void unlock();
|
|
|
|
typedef unique_lock<mutex> scoped_lock;
|
|
typedef scoped_lock scoped_try_lock;
|
|
};
|
|
|
|
__mutex__ implements the __lockable_concept__ to provide an exclusive-ownership mutex. At most one thread can own the lock on a given
|
|
instance of __mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__ and __unlock_ref__ shall be permitted.
|
|
|
|
[endsect]
|
|
|
|
[section:try_mutex Typedef `try_mutex`]
|
|
|
|
typedef mutex try_mutex;
|
|
|
|
__try_mutex__ is a `typedef` to __mutex__, provided for backwards compatibility with previous releases of boost.
|
|
|
|
[endsect]
|
|
|
|
[section:timed_mutex Class `timed_mutex`]
|
|
|
|
class timed_mutex:
|
|
boost::noncopyable
|
|
{
|
|
public:
|
|
timed_mutex();
|
|
~timed_mutex();
|
|
|
|
void lock();
|
|
void unlock();
|
|
bool try_lock();
|
|
bool timed_lock(system_time const & abs_time);
|
|
|
|
template<typename TimeDuration>
|
|
bool timed_lock(TimeDuration const & relative_time);
|
|
|
|
typedef unique_lock<timed_mutex> scoped_timed_lock;
|
|
typedef scoped_timed_lock scoped_try_lock;
|
|
typedef scoped_timed_lock scoped_lock;
|
|
};
|
|
|
|
__timed_mutex__ implements the __timed_lockable_concept__ to provide an exclusive-ownership mutex. At most one thread can own the
|
|
lock on a given instance of __timed_mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__,
|
|
__timed_lock_ref__, __timed_lock_duration_ref__ and __unlock_ref__ shall be permitted.
|
|
|
|
[endsect]
|
|
|
|
[section:recursive_mutex Class `recursive_mutex`]
|
|
|
|
class recursive_mutex:
|
|
boost::noncopyable
|
|
{
|
|
public:
|
|
recursive_mutex();
|
|
~recursive_mutex();
|
|
|
|
void lock();
|
|
bool try_lock();
|
|
void unlock();
|
|
|
|
typedef unique_lock<recursive_mutex> scoped_lock;
|
|
typedef scoped_lock scoped_try_lock;
|
|
};
|
|
|
|
__recursive_mutex__ implements the __lockable_concept__ to provide an exclusive-ownership recursive mutex. At most one thread can
|
|
own the lock on a given instance of __recursive_mutex__ at any time. Multiple concurrent calls to __lock_ref__, __try_lock_ref__ and
|
|
__unlock_ref__ shall be permitted. A thread that already has exclusive ownership of a given __recursive_mutex__ instance can call
|
|
__lock_ref__ or __try_lock_ref__ to acquire an additional level of ownership of the mutex. __unlock_ref__ must be called once for
|
|
each level of ownership acquired by a single thread before ownership can be acquired by another thread.
|
|
|
|
[endsect]
|
|
|
|
[section:recursive_try_mutex Typedef `recursive_try_mutex`]
|
|
|
|
typedef recursive_mutex recursive_try_mutex;
|
|
|
|
__recursive_try_mutex__ is a `typedef` to __recursive_mutex__, provided for backwards compatibility with previous releases of boost.
|
|
|
|
[endsect]
|
|
|
|
[section:recursive_timed_mutex Class `recursive_timed_mutex`]
|
|
|
|
class recursive_timed_mutex:
|
|
boost::noncopyable
|
|
{
|
|
public:
|
|
recursive_timed_mutex();
|
|
~recursive_timed_mutex();
|
|
|
|
void lock();
|
|
bool try_lock();
|
|
void unlock();
|
|
|
|
bool timed_lock(system_time const & abs_time);
|
|
|
|
template<typename TimeDuration>
|
|
bool timed_lock(TimeDuration const & relative_time);
|
|
|
|
typedef unique_lock<recursive_timed_mutex> scoped_lock;
|
|
typedef scoped_lock scoped_try_lock;
|
|
typedef scoped_lock scoped_timed_lock;
|
|
};
|
|
|
|
__recursive_timed_mutex__ implements the __timed_lockable_concept__ to provide an exclusive-ownership recursive mutex. At most one
|
|
thread can own the lock on a given instance of __recursive_timed_mutex__ at any time. Multiple concurrent calls to __lock_ref__,
|
|
__try_lock_ref__, __timed_lock_ref__, __timed_lock_duration_ref__ and __unlock_ref__ shall be permitted. A thread that already has
|
|
exclusive ownership of a given __recursive_timed_mutex__ instance can call __lock_ref__, __timed_lock_ref__,
|
|
__timed_lock_duration_ref__ or __try_lock_ref__ to acquire an additional level of ownership of the mutex. __unlock_ref__ must be
|
|
called once for each level of ownership acquired by a single thread before ownership can be acquired by another thread.
|
|
|
|
[endsect]
|
|
|
|
[include shared_mutex_ref.qbk]
|
|
|
|
[endsect]
|