XFcMutex class Reference

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XFcMutex Class Reference

Mutual exclusion (mutex) class. More...

List of all members.

## Public Member Functions

XFCIMPORT void | lock ()
| Locks the mutex.
XFCIMPORT void | unlock ()
| Unlocks the mutex.
virtual XFCIMPORT | ~XFcMutex ()
| Virtual destructor.

## Static Public Member Functions

XFCIMPORT XFcMutex * | create ()
| Creates a mutex object.

## Protected Member Functions

| XFcMutex ()
| Constructor.
INT | init ()
| Initializes mutex.
void | doLock ()
| Does the real lock operation.
void | doUnlock ()
| Does the real unlock operation.

## Protected Attributes

UINT32 | mLockingThreadId
| The id of the thread that has locked the mutex.
INT32 | mLockCount
| The number of times the locking thread has called lock().

## Private Attributes

void * | mMutex
| Mutex handle.

## Detailed Description

Mutual exclusion (mutex) class.

In order to synchronize code running in several threads, you may want to use a mutex. All threads will pause on mutex lock if some thread has already locked it, and will resume once the locking thread calls unlock.

## Constructor & Destructor Documentation

virtual XFCIMPORT XFcMutex::~XFcMutex | ( |  | ) | `[virtual]`

| Virtual destructor.

XFcMutex::XFcMutex | ( |  | ) | `[protected]`

| Constructor.

## Member Function Documentation

XFCIMPORT XFcMutex* XFcMutex::create | ( |  | ) | `[static]`

Creates a mutex object.

Returns:
  pointer to a new mutex object or NULL if unsuccessful

void XFcMutex::doLock | ( |  | ) | `[protected]`

| Does the real lock operation.

void XFcMutex::doUnlock | ( |  | ) | `[protected]`

| Does the real unlock operation.

INT XFcMutex::init | ( |  | ) | `[protected]`

Initializes mutex.

Returns:
  1 if successful, 0 if unsuccessful.

XFCIMPORT void XFcMutex::lock | ( |  | ) |

Locks the mutex.

Note:
  Blocks until the mutex is available for locking. Returns immediately if the caller thread already has the lock.

XFCIMPORT void XFcMutex::unlock | ( |  | ) |

| Unlocks the mutex.

## Member Data Documentation

INT32 XFcMutex::mLockCount`[protected]`

| The number of times the locking thread has called lock().

UINT32 XFcMutex::mLockingThreadId`[protected]`

| The id of the thread that has locked the mutex.

void* XFcMutex::mMutex`[private]`

| Mutex handle.

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch