Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class interprocess_recursive_mutex

boost::interprocess::interprocess_recursive_mutex

Synopsis

// In header: <boost/interprocess/sync/interprocess_recursive_mutex.hpp>


class interprocess_recursive_mutex {
public:
  // construct/copy/destruct
  ();
  ~();

  // public member functions
   ();
   ();
  template<typename TimePoint>  ();
  template<typename TimePoint>  ();
  template<typename Duration>  ();
   ();
};

Description

Wraps a interprocess_mutex that can be placed in shared memory and can be shared between processes. Allows several locking calls by the same process. Allows timed lock tries

interprocess_recursive_mutex public construct/copy/destruct

  1. ();

    Constructor. Throws interprocess_exception on error.

  2. ~();

    Destructor. If any process uses the mutex after the destructor is called the result is undefined. Does not throw.

interprocess_recursive_mutex public member functions

  1.  ();

    Effects: The calling thread tries to obtain ownership of the mutex, and if another thread has ownership of the mutex, it waits until it can obtain the ownership. If a thread takes ownership of the mutex the mutex must be unlocked by the same mutex. The mutex must be unlocked the same number of times it is locked. Throws: interprocess_exception on error.

    Note: A program shall not deadlock if the thread that has ownership calls this function.

  2.  ();

    Tries to lock the interprocess_mutex, returns false when interprocess_mutex is already locked, returns true when success. The mutex must be unlocked the same number of times it is locked. Throws: interprocess_exception if a severe error is found

    Note: A program shall not deadlock if the thread that has ownership calls this function.

  3. template<typename TimePoint>  ( abs_time);

    Tries to lock the interprocess_mutex, if interprocess_mutex can't be locked before abs_time time, returns false. The mutex must be unlocked the same number of times it is locked. Throws: interprocess_exception if a severe error is found

    Note: A program shall not deadlock if the thread that has ownership calls this function.

  4. template<typename TimePoint>  ( abs_time);

    Same as timed_lock, but this function is modeled after the standard library interface.

  5. template<typename Duration>  ( dur);

    Same as timed_lock, but this function is modeled after the standard library interface.

  6.  ();

    Effects: The calling thread releases the exclusive ownership of the mutex. If the mutex supports recursive locking, the mutex must be unlocked the same number of times it is locked. Throws: interprocess_exception on error.


PrevUpHomeNext