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

RWReadersWriterLock

Module:  Threads   Package:  Synchronization


RWReadersWriterLock RWSynchObject

Local Index

Members

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);

Public Destructor

~RWReadersWriterLock();

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();
RWWaitStatus
acquire(unsigned long milliseconds);
void
acquireRead();
RWWaitStatus
acquireRead(unsigned long milliseconds);
void
acquireWrite();
RWWaitStatus
acquireWrite(unsigned long milliseconds);
void
release();
bool
tryAcquire();
bool
tryAcquireRead();
bool
tryAcquireWrite();

Private Constructor

RWReadersWriterLock(const RWReadersWriterLock& second);

Private Member Operator

RWReadersWriterLock&
operator=(const RWReadersWriterLock& second);

See Also

RWTReadLockGuard<Resource>, RWTTryReadLockGuard<Resource>, RWTReadUnlockGuard<Resource>, RWTWriteLockGuard<Resource>, RWTTryWriteLockGuard<Resource>, RWTWriteUnlockGuard<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.