Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWReadersWriterLock


RWReadersWriterLock RWSynchObject

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

Data Types

Member Functions

Package

Synchronization

Header File

#include <rw/sync/RWReadersWriterLock.h> 

Description

RWReadersWriterLock is a multiple-readers, single-writer synchronization lock. With this type of lock, multiple readers are allowed concurrent access to the protected critical section. However, exclusive access is granted to writers; a reader and a writer cannot both enter the critical section, and only one writer at a time will be granted access. A writer that attempts to acquire the lock will block waiting for readers to exit the critical section. Note that because this lock favors writers over readers, the writer will get priority over any readers that try to access the lock after the time the writer attempts to acquire it. A reader attempting to access the lock will only acquire it after all writers attempting access have acquired and released the lock.

Example

Public Constructor

RWReadersWriterLock(RWCancellationState
state=RW_CANCELLATION_DISABLED) throws(RWTHRInternalError);

Public Destructor

~RWReadersWriterLock(void)
throws(RWTHRInternalError);

Member Typedefs

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

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);
void
release(void);
RWBoolean
tryAcquire(void);
RWBoolean
tryAcquireRead(void);
RWBoolean
tryAcquireWrite(void);

See Also

RWTReadLockGuard<Resource>, RWTTryReadLockGuard<Resource>, RWTReadUnlockGuard<Resource>, RWTWriteLockGuard<Resource>, RWTTryWriteLockGuard<Resource>, RWTWriteUnlockGuard<Resource>



Previous fileTop of DocumentContentsIndexNext file

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