SourcePro® 2022.1 |
SourcePro® API Reference Guide |
Provides mutual exclusion for a critical section of code in which only one thread should execute at a time. More...
#include <rw/sync/RWCriticalSection.h>
Public Types | |
typedef RWTLockGuard< RWCriticalSection > | LockGuard |
typedef RWTLockGuard< RWCriticalSection > | ReadLockGuard |
typedef RWTUnlockGuard< RWCriticalSection > | ReadUnlockGuard |
typedef RWTUnlockGuard< RWCriticalSection > | UnlockGuard |
typedef RWTLockGuard< RWCriticalSection > | WriteLockGuard |
typedef RWTUnlockGuard< RWCriticalSection > | WriteUnlockGuard |
Public Member Functions | |
RWCriticalSection (RWStaticCtor) | |
RWCriticalSection (RWCancellationState state=0) | |
~RWCriticalSection () | |
void | acquire () |
void | acquireRead () |
void | acquireWrite () |
RWCriticalSectionRep * | getCriticalSectionRep () const |
void | release () |
Public Member Functions inherited from RWSynchObject | |
void | disableCancellation () |
void | enableCancellation (RWCancellationState) |
bool | isCancellationEnabled () const |
void | setCancellation (RWCancellationState) |
Private Member Functions | |
RWCriticalSection (const RWCriticalSection &) | |
RWCriticalSection & | operator= (const RWCriticalSection &) |
Related Functions | |
(Note that these are not member functions.) | |
typedef RW_MUTEX_T | RWCriticalSectionRep |
Related Functions inherited from RWSynchObject | |
#define | RW_CANCELLATION_DISABLED |
#define | RW_CANCELLATION_ENABLED |
typedef void(* | RWCancellationState) () |
void | rwServiceCancellation (void) |
Additional Inherited Members | |
Protected Member Functions inherited from RWSynchObject | |
RWSynchObject (RWCancellationState state=0) | |
RWSynchObject (RWStaticCtor) | |
RWSynchObject (const RWSynchObject &second) | |
RWSynchObject & | operator= (const RWSynchObject &second) |
void | testCancellation () |
An RWCriticalSection object is used to provide mutual exclusion for a critical section of code, i.e. code in which only one thread should execute at a time. This lock operates in a manner that is identical to RWMutexLock except that on certain platforms, for example Win32, it may yield superior performance when there is minimal contention for the lock.
Predefined type for compatible guard.
Predefined type for compatible guard.
Predefined type for compatible guard.
Predefined type for compatible guard.
Predefined type for compatible guard.
Predefined type for compatible guard.
|
inline |
Constructs a static instance, but does no direct initialization. The RWCriticalSection is initialized on first use.
This constructor must be used only for static instances. Use of this constructor with automatically or dynamically allocated instances produces errors or other unpredictable behavior.
Static instances are zero initialized, which results in an RWCriticalSection with cancellation state of RW_CANCELLATION_DISABLED.
|
inline |
Creates and initializes the critical section. Possible exceptions include RWTHRInternalError.
|
inline |
Default destructor.
|
private |
Copy construction prohibited.
|
inline |
Blocks until the critical section is available. Possible exceptions include RWCancellation and RWTHRInternalError.
In single-threaded builds, this method returns immediately. If the section is unavailable, a debug assertion will occur, or an RWTHRInternalError will be thrown.
|
inline |
Calls acquire(). Provided for compatibility with Read/Write locks. Possible exceptions include RWCancellation and RWTHRInternalError.
|
inline |
Calls acquire(). Provided for compatibility with Read/Write locks. Possible exceptions include RWCancellation and RWTHRInternalError.
|
inline |
Provides access to the underlying platform-specific critical section implementation.
|
private |
Assignment prohibited.
|
inline |
Releases the critical section. Possible exceptions include RWTHRInternalError.
|
related |
Typedef for the internal critical section.
Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |