| Home | Libraries | People | FAQ | More

## Class recursive_timed_mutex

boost::recursive_timed_mutex —

The recursive_timed_mutex class is a model of the TimedMutex concept.

## Synopsis

    class recursive_timed_mutex : private boost::noncopyable   // Exposition only
    {
    public:
      // types
      typedef implementation-defined scoped_lock;
      typedef implementation-defined scoped_try_lock;
      typedef implementation-defined scoped_timed_lock;

      // construct/copy/destruct
      recursive_timed_mutex();
      ~recursive_timed_mutex();
    };

## Description

The recursive_timed_mutex class is a model of the TimedMutex concept. It should be used to synchronize access to shared resources using Recursive locking mechanics.

For classes that model related mutex concepts, see recursive_mutex and recursive_try_mutex.

For Unspecified locking mechanics, see mutex, try_mutex, and timed_mutex.

The recursive_timed_mutex class supplies the following typedefs, which model the specified locking strategies:

Table 15.25. Supported Lock Types

Lock Name | Lock Concept
--- | ---
scoped_lock | ScopedLock
scoped_try_lock | ScopedTryLock
scoped_timed_lock | ScopedTimedLock

The recursive_timed_mutex class uses a Recursive locking strategy, so attempts to recursively lock a recursive_timed_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_timed_mutex leaves the scheduling policy as Unspecified. Programmers should make no assumptions about the order in which waiting threads acquire a lock.

### `recursive_timed_mutex` construct/copy/destruct

1.     recursive_timed_mutex();

   Effects: | Constructs a recursive_timed_mutex object.
   Postconditions: | `*this` is in an unlocked state.

2.     ~recursive_timed_mutex();

   Effects: | Destroys a recursive_timed_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