Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class named_recursive_mutex

boost::interprocess::named_recursive_mutex

Synopsis

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


class named_recursive_mutex {
public:
  // construct/copy/destruct
  (create_only_t, , 
                        permissions & = permissions());
  (open_or_create_t, , 
                        permissions & = permissions());
  (open_only_t, );
  (create_only_t, , 
                        permissions & = permissions());
  (open_or_create_t, , 
                        permissions & = permissions());
  (open_only_t, );
  ~();

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

  // public static functions
   ();
   ();
};

Description

A recursive mutex with a global name, so it can be found from different processes. This mutex can't be placed in shared memory, and each process should have it's own named_recursive_mutex.

named_recursive_mutex public construct/copy/destruct

  1. (create_only_t,  name, 
                          permissions & perm = permissions());

    Creates a global recursive_mutex with a name. If the recursive_mutex can't be created throws interprocess_exception

  2. (open_or_create_t,  name, 
                          permissions & perm = permissions());

    Opens or creates a global recursive_mutex with a name. If the recursive_mutex is created, this call is equivalent to named_recursive_mutex(create_only_t, ... ) If the recursive_mutex is already created, this call is equivalent named_recursive_mutex(open_only_t, ... ) Does not throw

  3. (open_only_t,  name);

    Opens a global recursive_mutex with a name if that recursive_mutex is previously created. If it is not previously created this function throws interprocess_exception.

  4. (create_only_t,  name, 
                          permissions & perm = permissions());

    Creates a global recursive_mutex with a name. If the recursive_mutex can't be created throws interprocess_exception

    Note: This function is only available on operating systems with native wchar_t APIs (e.g. Windows).

  5. (open_or_create_t,  name, 
                          permissions & perm = permissions());

    Opens or creates a global recursive_mutex with a name. If the recursive_mutex is created, this call is equivalent to named_recursive_mutex(create_only_t, ... ) If the recursive_mutex is already created, this call is equivalent named_recursive_mutex(open_only_t, ... ) Does not throw

    Note: This function is only available on operating systems with native wchar_t APIs (e.g. Windows).

  6. (open_only_t,  name);

    Opens a global recursive_mutex with a name if that recursive_mutex is previously created. If it is not previously created this function throws interprocess_exception.

    Note: This function is only available on operating systems with native wchar_t APIs (e.g. Windows).

  7. ~();

    Destroys *this and indicates that the calling process is finished using the resource. The destructor function will deallocate any system resources allocated by the system for use by this process for this resource. The resource can still be opened again calling the open constructor overload. To erase the resource from the system use remove().

named_recursive_mutex public member functions

  1.  ();

    Unlocks a previously locked named_recursive_mutex.

  2.  ();

    Locks named_recursive_mutex, sleeps when named_recursive_mutex is already 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.  ();

    Tries to lock the named_recursive_mutex, returns false when named_recursive_mutex is already locked, returns true when success. 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);

    Tries to lock the named_recursive_mutex until time abs_time, Returns false when timeout expires, returns true when locks. Throws interprocess_exception if a severe error is found

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

  5. template<typename TimePoint>  ( abs_time);

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

  6. template<typename Duration>  ( dur);

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

named_recursive_mutex public static functions

  1.  ( name);

    Erases a named recursive mutex from the system

  2.  ( name);

    Erases a named recursive mutex from the system

    Note: This function is only available on operating systems with native wchar_t APIs (e.g. Windows).


PrevUpHomeNext