RFastLock Class Reference

#include <e32cmn.h>

class RFastLock : public RSemaphore

Inherits from

Detailed Description

A fast semaphore.

This is a layer over a standard semaphore, and only calls into the kernel side if there is contention.

Constructor & Destructor Documentation

RFastLock ( )

RFastLock()[inline]

Default constructor.

Member Function Documentation

CreateLocal ( TOwnerType )

IMPORT_C TIntCreateLocal(TOwnerTypeaType = EOwnerProcess)

Creates a local fast semaphore, and opens this handle to the semaphore.

See also: RSemaphore::CreateLocal()

Parameters
aTypeAn enumeration whose enumerators define the ownership of this semaphore handle. If not explicitly specified, EOwnerProcess is taken as default.
Return Value
KErrNone if successful, otherwise one of the system wide error codes.

Poll ( )

IMPORT_C TIntPoll()

Reimplemented from RSemaphore::Poll()

Acquires the semaphore if that is possible without waiting.

Return Value
KErrNone if the semaphore was acquired successfully KErrTimedOut if the semaphore could not be acquired KErrGeneral if the semaphore is being reset, i.e the semaphore is about to be deleted.

Signal ( )

IMPORT_C voidSignal()

Reimplemented from RSemaphore::Signal()

Signals the semaphore once.

The function increments the semaphore count by one. If the count was negative before being incremented, the highest priority thread waiting on the semaphore's queue of threads is removed from that queue and, provided that it is not suspended for any other reason, is marked as ready to run.

Wait ( )

IMPORT_C voidWait()

Reimplemented from RSemaphore::Wait()

Waits for a signal on the semaphore.

The function decrements the semaphore count by one and returns immediately if it is zero or positive.

If the semaphore count is negative after being decremented, the calling thread is added to a queue of threads maintained by this semaphore.

The thread waits until the semaphore is signalled. More than one thread can be waiting on a particular semaphore at a time. When there are multiple threads waiting on a semaphore, they are released in priority order.

If the semaphore is deleted, all threads waiting on that semaphore are released.

Wait ( TInt )

IMPORT_C TIntWait(TIntaTimeout)

Reimplemented from RSemaphore::Wait(TInt)

Acquire the lock, if necessary waiting up to a specified maximum amount of time for it to become free.

This function checks if the lock is currently held. If not the lock is marked as held by the current thread and the call returns immediately. If the lock is held by another thread the current thread will suspend until the lock becomes free or until the specified timeout period has elapsed.

Parameters
aTimeoutThe timeout value in microseconds
Return Value
KErrNone if the lock was acquired successfully. KErrTimedOut if the timeout has expired. KErrGeneral if the lock is being reset, i.e the lock is about to be deleted. KErrArgument if aTimeout is negative; otherwise one of the other system wide error codes.