WiFi Framework C++ Edition
CwclMutex Class Reference

The class represents a mutex synchronization object. More...

#include <wclSync.h>

Inheritance diagram for CwclMutex:
CwclNamedSyncObject CwclWaitableSyncObject CwclSyncObject

Public Member Functions

unsigned long Acquire ()
 Acquires the mutex object.
 
unsigned long Acquire (const unsigned long Timeout)
 Tries to acquire the mutex object during the given time-out interval.
 
bool Release ()
 Releases the mutex object.
 
- Public Member Functions inherited from CwclNamedSyncObject
virtual ~CwclNamedSyncObject ()
 Frees the named synchronization object.
 
- Public Member Functions inherited from CwclWaitableSyncObject
virtual ~CwclWaitableSyncObject ()
 Frees the waitable synchronization object.
 
HANDLE GetHandle () const
 Gets the system dependent synchronization object handle.
 
 __declspec (property(get=GetHandle)) HANDLE Handle
 Gets the system dependent synchronization object handle.
 
- Public Member Functions inherited from CwclSyncObject
virtual ~CwclSyncObject ()
 Frees the synchronization object.
 

Static Public Member Functions

static CwclMutex * Create ()
 Creates an unnamed mutex object.
 
static CwclMutex * Create (const tstring &Name)
 Creates or opens a named mutex object.
 
static CwclMutex * Create (const tstring &Name, bool &Exist)
 Creates or opens a named mutex object.
 
static CwclMutex * Open (const tstring &Name)
 Opens an existing mutex with the specified name.
 
- Static Public Member Functions inherited from CwclWaitableSyncObject
static unsigned long WaitAll (const unsigned long Count, CwclWaitableSyncObject **const Objects)
 Waits until all of the specified objects are in the signaled state.
 
static unsigned long WaitAll (const unsigned long Count, CwclWaitableSyncObject **const Objects, const unsigned long Timeout)
 Waits until all of the specified objects are in the signaled state or the time-out interval elapses.
 
static unsigned long WaitAny (const unsigned long Count, CwclWaitableSyncObject **const Objects)
 Waits until one or all of the specified objects are in the signaled state.
 
static unsigned long WaitAny (const unsigned long Count, CwclWaitableSyncObject **const Objects, const unsigned long Timeout)
 Waits until one of the specified objects are in the signaled state or the time-out interval elapses.
 

Protected Member Functions

 CwclMutex (const HANDLE Handle)
 Creates new mutex object.
 
- Protected Member Functions inherited from CwclNamedSyncObject
 CwclNamedSyncObject (const HANDLE Handle)
 Creates new synchronization object.
 
- Protected Member Functions inherited from CwclWaitableSyncObject
 CwclWaitableSyncObject (const HANDLE Handle)
 Creates new synchronization object.
 
virtual unsigned long WaitOne ()
 Waits until the object is in the signaled state.
 
virtual unsigned long WaitOne (const unsigned long Timeout)
 Waits until the object is in the signaled state or the time-out interval elapses.
 
- Protected Member Functions inherited from CwclSyncObject
 CwclSyncObject ()
 Creates new synchronization object.
 

Additional Inherited Members

- Static Protected Member Functions inherited from CwclNamedSyncObject
static tstring MakeUniqueName (const tstring &Name)
 Makes unique synchronization object name.
 

Detailed Description

The class represents a mutex synchronization object.

A mutex object is a synchronization object whose state is set to signaled when it is not owned by any thread, and nonsignaled when it is owned. Only one thread at a time can own a mutex object, whose name comes from the fact that it is useful in coordinating mutually exclusive access to a shared resource.

See also
CwclNamedSyncObject