#include <e32cmn.h>
class RReadWriteLock |
Public Member Enumerations | |
---|---|
enum | TReadWriteLockClientCategoryLimit { EReadWriteLockClientCategoryLimit } |
enum | TReadWriteLockPriority { EWriterPriority, EAlternatePriority, EReaderPriority } |
Public Member Functions | |
---|---|
RReadWriteLock() | |
IMPORT_C void | Close() |
IMPORT_C TInt | CreateLocal(TReadWriteLockPriority) |
IMPORT_C void | DowngradeWriteLock() |
IMPORT_C void | ReadLock() |
IMPORT_C TBool | TryReadLock() |
IMPORT_C TBool | TryUpgradeReadLock() |
IMPORT_C TBool | TryWriteLock() |
IMPORT_C void | Unlock() |
IMPORT_C void | WriteLock() |
A read-write lock.
This is a lock for co-ordinating readers and writers to shared resources. It is designed to allow multiple concurrent readers. It is not a kernel side object and so does not inherit from RHandleBase.
Enumerator | Value | Description |
---|---|---|
EReadWriteLockClientCategoryLimit | KMaxTUint16 |
Maximum number of clients in each category: read locked, read lock pending, write lock pending |
Enumerator | Value | Description |
---|---|---|
EWriterPriority |
Pending writers always get the lock before pending readers | |
EAlternatePriority |
Lock is given alternately to pending readers and writers | |
EReaderPriority |
Pending readers always get the lock before pending writers - beware writer starvation! |
IMPORT_C void | Close | ( | ) |
Panic Codes | |
---|---|
EReadWriteLockStillPending | if there are any outstanding clients or pending clients |
IMPORT_C TInt | CreateLocal | ( | TReadWriteLockPriority | aPriority = EWriterPriority | ) |
Parameters | |
---|---|
aPriority | Type of priority to use - see RReadWriteLockPriority::TReadWriteLockPriority |
Panic Codes | |
---|---|
EReadWriteLockInvalidPriority | if aPriority is not valid. |
IMPORT_C void | DowngradeWriteLock | ( | ) |
Priority is EPriorityReader or
Panic Codes | |
---|---|
EReadWriteLockBadLockState | if the lock is not currently held |
IMPORT_C void | ReadLock | ( | ) |
Panic Codes | |
---|---|
EReadWriteLockTooManyClients | if the resulting number of readers or pending readers exceeds EReadWriteLockClientCategoryLimit |
IMPORT_C TBool | TryReadLock | ( | ) |
See also: ReadLock()
Panic Codes | |
---|---|
EReadWriteLockTooManyClients | if the resulting number of readers exceeds EReadWriteLockClientCategoryLimit |
IMPORT_C TBool | TryUpgradeReadLock | ( | ) |
There are no pending writers or
Panic Codes | |
---|---|
EReadWriteLockBadLockState | if the read lock is not currently held |
IMPORT_C TBool | TryWriteLock | ( | ) |
Ask for a write lock without blocking.
See also: WriteLock()
IMPORT_C void | Unlock | ( | ) |
Give the lock to the first pending writer, if there is one
Else give the lock to all pending readers, if there are any
If there are pending writers then unblock one pending reader
Else if there are no pending writers then unblock all pending readers
Panic Codes | |
---|---|
EReadWriteLockBadLockState | if the lock is not currently held |
IMPORT_C void | WriteLock | ( | ) |
Panic Codes | |
---|---|
EReadWriteLockTooManyClients | if the resulting number of pending writers exceeds EReadWriteLockClientCategoryLimit |