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

A handle to a critical section. More...

#include <e32std.h>

Inheritance diagram for RCriticalSection:
RSemaphore

Public Member Functions

IMPORT_C RCriticalSection ()
 Default constructor.
 
IMPORT_C TInt CreateLocal (TOwnerType aType=EOwnerProcess)
 Creates a critical section and opens this handle to the critical section.
 
IMPORT_C void Close ()
 Closes the handle to the critical section.
 
IMPORT_C void Wait ()
 Waits for the critical section to become free.
 
IMPORT_C void Signal ()
 Signals an exit from the critical section.
 
TBool IsBlocked () const
 Tests whether the critical section is occupied by any thread.
 

Detailed Description

A handle to a critical section.

A critical section itself is a kernel object, and is implemented using a semaphore. The class RCriticalSection inherits privately from RSemaphore as a matter of implementation and this is, in effect, equivalent to using a semaphore.

The public functions of RSemaphore are not part of the public API of this class.

As with all handles, they should be closed after use. This class provides the necessary Close() function, which should be called when the handle is no longer required.

See also
RHandleBase::Close
API status
Published to all clients. Released API.

Definition at line 3471 of file e32std.h.

Constructor & Destructor Documentation

◆ RCriticalSection()

IMPORT_C RCriticalSection::RCriticalSection ( )

Default constructor.

(generated from Symbian Developer Library)

Member Function Documentation

◆ Close()

IMPORT_C void RCriticalSection::Close ( )

Closes the handle to the critical section.

As a critical section object is implemented using a semaphore, this has the effect of closing the handle to the semaphore.

(generated from Symbian Developer Library)

◆ CreateLocal()

IMPORT_C TInt RCriticalSection::CreateLocal ( TOwnerType  aType = EOwnerProcess)

Creates a critical section and opens this handle to the critical section.

The kernel side object representing the critical section is unnamed. This means that it is not possible to search for the critical section, which makes it local to the current process.

By default, any thread in the process can use this instance of RCriticalSection to access the critical section. However, specifying EOwnerThread as the parameter to this function, means that only the creating thread can use this instance of RCriticalSection to access the critical section; any other thread in this process that wants to access the critical section must duplicate this handle.

RHandleBase::Duplicate()

Parameters
aTypeAn enumeration whose enumerators define the ownership of this critical section handle. If not explicitly specified, EOwnerProcess is taken as default.

(generated from Symbian Developer Library)

◆ IsBlocked()

TBool RCriticalSection::IsBlocked ( ) const
inline

Tests whether the critical section is occupied by any thread.

(generated from Symbian Developer Library)

◆ Signal()

IMPORT_C void RCriticalSection::Signal ( )

Signals an exit from the critical section.

A thread calls this function when it exits from the critical section. The first eligible thread waiting on the critical section'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. That thread will, therefore, be the next to proceed into the critical section.

(generated from Symbian Developer Library)

◆ Wait()

IMPORT_C void RCriticalSection::Wait ( )

Waits for the critical section to become free.

If no other thread is in the critical section, control returns immediately and the current thread can continue into the section.

If another thread is already in the critical section, the current thread is marked as waiting (on a semaphore); the current thread is added to a queue of threads maintained by this critical section.

(generated from Symbian Developer Library)


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