Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
RReadWriteLock Class Reference

A read-write lock. More...

#include <e32cmn.h>

Public Types

enum  TReadWriteLockPriority { EWriterPriority , EAlternatePriority , EReaderPriority }
 
enum  TReadWriteLockClientCategoryLimit { EReadWriteLockClientCategoryLimit = KMaxTUint16 }
 

Public Member Functions

 RReadWriteLock ()
 Default constructor.
 
IMPORT_C TInt CreateLocal (TReadWriteLockPriority aPriority=EWriterPriority)
 
IMPORT_C void Close ()
 Panic condition: EReadWriteLockStillPending if there are any outstanding clients or pending clients.
 
IMPORT_C void ReadLock ()
 Panic condition: EReadWriteLockTooManyClients if the resulting number of readers or pending readers exceeds EReadWriteLockClientCategoryLimit.
 
IMPORT_C void WriteLock ()
 Panic condition: EReadWriteLockTooManyClients if the resulting number of pending writers exceeds EReadWriteLockClientCategoryLimit.
 
IMPORT_C TBool TryReadLock ()
 Panic condition: EReadWriteLockTooManyClients if the resulting number of readers exceeds EReadWriteLockClientCategoryLimit.
 
IMPORT_C TBool TryWriteLock ()
 Ask for a write lock without blocking.
 
IMPORT_C TBool TryUpgradeReadLock ()
 
IMPORT_C void DowngradeWriteLock ()
 
IMPORT_C void Unlock ()
 

Detailed Description

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.

API status
Published to all clients. Released API.

Definition at line 2695 of file e32cmn.h.

Member Enumeration Documentation

◆ TReadWriteLockClientCategoryLimit

Enumerator
EReadWriteLockClientCategoryLimit 

Maximum number of clients in each category: read locked, read lock pending, write lock pending.

Definition at line 2707 of file e32cmn.h.

◆ TReadWriteLockPriority

Enumerator
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!

Definition at line 2698 of file e32cmn.h.

Constructor & Destructor Documentation

◆ RReadWriteLock()

RReadWriteLock::RReadWriteLock ( )
inline

Default constructor.

(generated from Symbian Developer Library)

Member Function Documentation

◆ Close()

IMPORT_C void RReadWriteLock::Close ( )

Panic condition: EReadWriteLockStillPending if there are any outstanding clients or pending clients.

(generated from Symbian Developer Library)

◆ CreateLocal()

IMPORT_C TInt RReadWriteLock::CreateLocal ( TReadWriteLockPriority  aPriority = EWriterPriority)
Parameters
aPriorityType of priority to use - see RReadWriteLockPriority::TReadWriteLockPriority

Panic condition: EReadWriteLockInvalidPriority if aPriority is not valid.

(generated from Symbian Developer Library)

◆ DowngradeWriteLock()

IMPORT_C void RReadWriteLock::DowngradeWriteLock ( )
  • Priority is EPriorityReader or
  • There are no pending writers This function can not fail, so it does not return anything. panic EReadWriteLockBadLockState if the lock is not currently held

Panic condition: EReadWriteLockBadLockState if the lock is not currently held

(generated from Symbian Developer Library)

◆ ReadLock()

IMPORT_C void RReadWriteLock::ReadLock ( )

Panic condition: EReadWriteLockTooManyClients if the resulting number of readers or pending readers exceeds EReadWriteLockClientCategoryLimit.

(generated from Symbian Developer Library)

◆ TryReadLock()

IMPORT_C TBool RReadWriteLock::TryReadLock ( )

Panic condition: EReadWriteLockTooManyClients if the resulting number of readers exceeds EReadWriteLockClientCategoryLimit.

(generated from Symbian Developer Library)

◆ TryUpgradeReadLock()

IMPORT_C TBool RReadWriteLock::TryUpgradeReadLock ( )
  • This is the only reader andThere are no pending writers or The priority is reader panic EReadWriteLockBadLockState if the read lock is not currently held

Panic condition: EReadWriteLockBadLockState if the read lock is not currently held

(generated from Symbian Developer Library)

◆ TryWriteLock()

IMPORT_C TBool RReadWriteLock::TryWriteLock ( )

Ask for a write lock without blocking.

WriteLock()

(generated from Symbian Developer Library)

◆ Unlock()

IMPORT_C void RReadWriteLock::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 readers:If there are pending writers then unblock one pending reader Else if there are no pending writers then unblock all pending readers
  • Else unblock one pending writer, if there is one EReaderPriority - Unblock all pending readers. If none then unblock one pending writer, if there is one EWriterPriority - Unblock one pending writer, if there is one. If none then unblock any and all pending readers panic EReadWriteLockBadLockState if the lock is not currently held

Panic condition: EReadWriteLockBadLockState if the lock is not currently held

(generated from Symbian Developer Library)

◆ WriteLock()

IMPORT_C void RReadWriteLock::WriteLock ( )

Panic condition: EReadWriteLockTooManyClients if the resulting number of pending writers exceeds EReadWriteLockClientCategoryLimit.

(generated from Symbian Developer Library)


The documentation for this class was generated from the following files: