Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWTRecursiveLock<Lock>


RWTRecursiveLock<Lock> RWSynchObject

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

Data Types

Member Functions

Package

Synchronization

Header File

#include <rw/sync/RWTRecursiveLock.h> 

Description

The RWMutexLock and RWFIFOMutexLock classes do not allow a thread to acquire the mutex if it already owns it. Attempts to do so will result in an assertion and abort in the debug version of the library, and may result in deadlock in the release version.

If you require recursive acquisition semantics for a mutex, you can use the RWTRecursiveLock<Lock> class to add this capability to an existing mutex class such as RWMutexLock or RWFIFOMutexLock.

This class allows the thread that owns a mutex to reacquire the mutex any number of times before ever releasing it. For each acquisition, however, the thread must release the mutex the same number of times before it will become available to another thread.

Example

Member Typedefs

typedef RWTLockGuard<RWTRecursiveLock<Mutex>> 
     LockGuard;
typedef RWTReadLockGuard<RWTRecursiveLock<Mutex>> 
     ReadLockGuard;
typedef RWTWriteLockGuard<RWTRecursiveLock<Mutex>>
     WriteLockGuard;
typedef RWTTryLockGuard<RWTRecursiveLock<Mutex>> 
     TryLockGuard;
typedef RWTTryReadLockGuard<RWTRecursiveLock<Mutex>>
     TryReadLockGuard;
typedef RWTTryWriteLockGuard<RWTRecursiveLock<Mutex>>
     TryWriteLockGuard;
typedef RWTUnlockGuard<RWTRecursiveLock<Mutex>> 
     UnlockGuard;
typedef RWTReadUnlockGuard<RWTRecursiveLock<Mutex>>
     ReadUnlockGuard;
typedef RWTWriteUnlockGuard<RWTRecursiveLock<Mutex>>
     WriteUnlockGuard;

Public Constructors

RWTRecursiveLock(RWCancellationState
state=RW_CANCELLATION_DISABLED);

Public Destructor

~RWTRecursiveLock(void);

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, RWFIFOMutexLock



Previous fileTop of DocumentContentsIndexNext file

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