Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWNullMutexLock


RWNullMutexLock RWSynchObject

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Data Types

Member Functions

Package

Synchronization

Header File

#include <rw/sync/RWNullMutexLock.h> 

Description

An RWNullMutexLock is an efficient stand-in for a mutual exclusion lock, particularly when you know that critical sections of code do not need synchronization. For example, you may know that it is not possible for more than one thread to simultaneously enter a section of code that would otherwise require locking. In such cases you can use an RWNullMutexLock to eliminate the unnecessary overhead of acquiring and releasing a mutex. This class can also be used to instantiate a single-threaded or non-thread-safe version of a template classes that accept a mutex parameter, such as RWTMonitor<Mutex>.

Example

Member Typedefs

typedef RWTLockGuard<RWNullMutexLock>          LockGuard;
typedef RWTReadLockGuard<RWNullMutexLock>      ReadLockGuard;
typedef RWTWriteLockGuard<RWNullMutexLock>     WriteLockGuard;

typedef RWTTryLockGuard<RWNullMutexLock>       TryLockGuard;
typedef RWTTryReadLockGuard<RWNullMutexLock>   TryReadLockGuard;
typedef RWTTryWriteLockGuard<RWNullMutexLock>  TryWriteLockGuard;

typedef RWTUnlockGuard<RWNullMutexLock>        UnlockGuard;
typedef RWTReadUnlockGuard<RWNullMutexLock>    ReadUnlockGuard;
typedef RWTWriteUnlockGuard<RWNullMutexLock>   WriteUnlockGuard;

Constructor

RWNullMutexLock(RWStaticCtor);
RWMutexLock(RWCancellationState 
state=RW_CANCELLATION_DISABLED);

Public Member Functions

void
acquire(void);
RWWaitStatus
acquire(unsigned long milliseconds);
void
acquireRead(void);
RWWaitStatus
acquireRead(unsigned long milliseconds);
void
acquireWrite(void);
RWWaitStatus
acquireWrite(unsigned long milliseconds);
RWBoolean
isAcquired(void) const;

NOTE: Only available from the debug version of the library
void
release(void);
RWBoolean
tryAcquire(void);
RWBoolean
tryAcquireRead(void);
RWBoolean
tryAcquireWrite(void);

See Also

RWMutexLock, RWTLockGuard<Resource>, RWTUnlockGuard<Resource>, RWTTryLockGuard<Resource>



Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.