process_mutex Class Reference
[Synchronisation Library]

#include <winstl/synch/process_mutex.hpp>

Inheritance diagram for process_mutex:

critical_section< STLSOFT_CRITICAL_SECTION_IS_RECURSIVE, STLSOFT_CRITICAL_SECTION_IS_TRYABLE > synchronisable_object_tag critical_section_tag

List of all members.


Detailed Description

This class acts as an inter-process mutex based on the Win32 mutex kernel object.

Public Types

Member Types
typedef process_mutex class_type
 This type.
typedef HANDLE synch_handle_type
typedef HANDLE resource_type

Public Member Functions

Construction
 process_mutex ()
 Creates an instance of the mutex.
 process_mutex (HANDLE mx, bool bTakeOwnership)
 Conversion constructor.
 process_mutex (char const *name)
 Creates an instance of the mutex.
 process_mutex (wchar_t const *name)
 Creates an instance of the mutex.
 process_mutex (bool bInitialOwer)
 Creates an instance of the mutex.
 process_mutex (char const *name, bool bInitialOwer)
 Creates an instance of the mutex.
 process_mutex (wchar_t const *name, bool bInitialOwer)
 Creates an instance of the mutex.
 process_mutex (char const *name, bool bInitialOwer, LPSECURITY_ATTRIBUTES psa)
 Creates an instance of the mutex.
 process_mutex (wchar_t const *name, bool bInitialOwer, LPSECURITY_ATTRIBUTES psa)
 Creates an instance of the mutex.
 ~process_mutex () throw ()
 Destroys an instance of the mutex.
Operations
void lock ()
 Acquires a lock on the mutex, pending the thread until the lock is aquired.
bool lock (ws_dword_t wait)
 Acquires a lock on the mutex, pending the thread until the lock is aquired.
bool try_lock ()
 Attempts to lock the mutex.
void unlock ()
 Releases an aquired lock on the mutex.
Accessors
HANDLE handle ()
 The underlying kernel object handle.
HANDLE get ()
 The underlying kernel object handle.
Attributes
bool created () const
 Indicates whether this object instance created the underlying mutex object.
bool abandoned () const
 Indicates whether a successful call to lock occurred because the underlying mutex was previously held by a thread that abandoned.

Member Typedef Documentation

This type.


Constructor & Destructor Documentation

process_mutex (  )  [inline]

Creates an instance of the mutex.

process_mutex ( HANDLE  mx,
bool  bTakeOwnership 
) [inline]

Conversion constructor.

References WINSTL_ASSERT.

process_mutex ( char const *  name  )  [inline, explicit]

Creates an instance of the mutex.

process_mutex ( wchar_t const *  name  )  [inline, explicit]

Creates an instance of the mutex.

process_mutex ( bool  bInitialOwer  )  [inline, explicit]

Creates an instance of the mutex.

process_mutex ( char const *  name,
bool  bInitialOwer 
) [inline, explicit]

Creates an instance of the mutex.

process_mutex ( wchar_t const *  name,
bool  bInitialOwer 
) [inline, explicit]

Creates an instance of the mutex.

process_mutex ( char const *  name,
bool  bInitialOwer,
LPSECURITY_ATTRIBUTES  psa 
) [inline, explicit]

Creates an instance of the mutex.

process_mutex ( wchar_t const *  name,
bool  bInitialOwer,
LPSECURITY_ATTRIBUTES  psa 
) [inline, explicit]

Creates an instance of the mutex.

~process_mutex (  )  throw () [inline]

Destroys an instance of the mutex.


Member Function Documentation

void lock (  )  [inline]

Acquires a lock on the mutex, pending the thread until the lock is aquired.

References WINSTL_ASSERT.

bool lock ( ws_dword_t  wait  )  [inline]

Acquires a lock on the mutex, pending the thread until the lock is aquired.

References WINSTL_ASSERT.

bool try_lock (  )  [inline]

Attempts to lock the mutex.

Returns:
true if the mutex was aquired, or false if not

void unlock (  )  [inline]

Releases an aquired lock on the mutex.

References WINSTL_ASSERT.

HANDLE handle (  )  [inline]

The underlying kernel object handle.

HANDLE get (  )  [inline]

The underlying kernel object handle.

Referenced by winstl::get_kernel_handle(), and winstl::get_synch_handle().

bool created (  )  const [inline]

Indicates whether this object instance created the underlying mutex object.

Returns:
true The mutex object was created by this instance

false The mutex object was not created by this instance

Note:
For unnamed mutexes this will always be false

bool abandoned (  )  const [inline]

Indicates whether a successful call to lock occurred because the underlying mutex was previously held by a thread that abandoned.

Returns:
true The mutex object was abandoned by its previous owning thread

false The mutex object was not abandoned by its previous owning thread

Note:
This attribute is meaningful with respect to the result of the last call to lock() or try_lock(). Subsequent calls to unlock() do not affect this attribute.


The documentation for this class was generated from the following file:

Generated on Thu Jun 10 08:59:36 2010 for STLSoft by  doxygen 1.5.6