Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWNullMutexLock

Module:  Threads   Package:  Synchronization


RWNullMutexLock RWSynchObject

Local Index

Members

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;

Public Constructor

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

Public Destructor

~RWMutexLock();

Public Member Functions

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

NOTE -- Only available from the debug version of the Threads Module.
void
release();
bool
tryAcquire();
bool
tryAcquireRead();
bool
tryAcquireWrite();

Private Constructor

RWNullMutexLock(const RWNullMutexLock& second);

Private Member Operator

RWNullMutexLock&
operator=(const RWNullMutexLock& second);

See Also

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



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.