Home | Libraries | People | FAQ | More |
boost::recursive_mutex —
The recursive_mutex class is a model of the Mutex concept.
class recursive_mutex : private boost::noncopyable // Exposition only { public: // types typedef implementation-defined scoped_lock; // construct/copy/destruct recursive_mutex(); ~recursive_mutex(); };
The recursive_mutex class is a model of the Mutex concept. It should be used to synchronize access to shared resources using Recursive locking mechanics.
For classes that model related mutex concepts, see recursive_try_mutex and recursive_timed_mutex.
For Unspecified locking mechanics, see mutex, try_mutex, and timed_mutex.
The recursive_mutex class supplies the following typedef, which models the specified locking strategy:
The recursive_mutex class uses a Recursive locking strategy, so attempts to recursively lock a recursive_mutex object succeed and an internal "lock count" is maintained. Attempts to unlock a recursive_mutex object by threads that don't own a lock on it result in undefined behavior.
Like all mutex models in Boost.Thread, recursive_mutex leaves the scheduling policy as Unspecified. Programmers should make no assumptions about the order in which waiting threads acquire a lock.
recursive_mutex
construct/copy/destructrecursive_mutex();
Effects: | Constructs a recursive_mutex object. |
Postconditions: |
*this is in an unlocked state.
|
~recursive_mutex();
Effects: | Destroys a recursive_mutex object. |
Requires: |
*this is in an unlocked state. |
Notes: | Danger: Destruction of a locked mutex is a serious programming error resulting in undefined behavior such as a program crash. |
Copyright © 2001-2003 William E. Kempf |