rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWSynchObject Class Reference
[Synchronization]

Base class for synchronization classes. More...

#include <rw/sync/RWSynchObject.h>

Inheritance diagram for RWSynchObject:
RWCondition RWCriticalSection RWFIFOMutexLock RWMutexLock RWNullMutexLock RWReadersWriterLock RWSemaphore RWTRecursiveLock< Mutex >

List of all members.

Public Member Functions

void enableCancellation (RWCancellationState)
void setCancellation (RWCancellationState)
void disableCancellation ()
bool isCancellationEnabled () const

Protected Member Functions

 RWSynchObject (RWCancellationState state=0)
 RWSynchObject (RWStaticCtor)
 RWSynchObject (const RWSynchObject &second)
RWSynchObjectoperator= (const RWSynchObject &second)
void testCancellation ()

Related Functions

(Note that these are not member functions.)



typedef void(* RWCancellationState )()
 RW_CANCELLATION_DISABLED
 RW_CANCELLATION_ENABLED
void rwServiceCancellation (void)

Detailed Description

RWSynchObject is the base class for synchronization classes, RWMutexLock, RWFIFOMutexLock, RWTRecursiveLock<Mutex>, RWSemaphore, RWCondition, RWReadersWriterLock, and RWCriticalSection. The class contains methods that support automatic cancellation detection for runnables containing a thread that is accessing the acquire() or wait() members of these derived classes.

See also:
RWMutexLock, RWNullMutexLock, RWFIFOMutexLock, RWTRecursiveLock<Mutex> , RWReadersWriterLock, RWSemaphore, RWCondition, RWCriticalSection

Constructor & Destructor Documentation

RWSynchObject::RWSynchObject ( RWCancellationState  state = 0  )  [inline, protected]

Enforces that this class be used only as a base class.

RWSynchObject::RWSynchObject ( RWStaticCtor   )  [inline, protected]

Constructs a static instance, but does no direct initialization. The RWSynchObject is initialized on first use.

This constructor must be used only for static instances. Use of this constructor with an automatically or dynamically allocated instance produces errors or other unpredictable behavior.

Static instances are zero initialized, which results in an RWSynchObject with a cancellation state of RW_CANCELLATION_DISABLED.

RWSynchObject::RWSynchObject ( const RWSynchObject second  )  [inline, protected]

Copy constructor.


Member Function Documentation

void RWSynchObject::disableCancellation (  )  [inline]

Turns off automatic cancellation detection.

void RWSynchObject::enableCancellation ( RWCancellationState  state  )  [inline]

Turns on automatic cancellation detection.

bool RWSynchObject::isCancellationEnabled (  )  const [inline]

Returns true if automatic cancellation is enabled, otherwise false.

RWSynchObject & RWSynchObject::operator= ( const RWSynchObject second  )  [inline, protected]

Assignment operator.

void RWSynchObject::setCancellation ( RWCancellationState  state  )  [inline]

Turns on automatic cancellation detection.

void RWSynchObject::testCancellation (  )  [inline, protected]

Invokes a cancellation method if one has been registered, otherwise does nothing.


Friends And Related Function Documentation

RW_CANCELLATION_DISABLED [related]

Flag to specify cancellation state.

RW_CANCELLATION_ENABLED [related]

Flag to specify cancellation state, defined in the Threading package as &rwServiceCancellation.

typedef void(* RWCancellationState)() [related]

This function pointer type is used with the Synchronization objects to set the cancellation policy.

RW_CANCELLATION_DISABLED is defined in the Synchronization package to be 0. RW_CANCELLATION_ENABLED is defined in the Threading package as &rwServiceCancellation. Either macro may be passed where an RWCancellationState is expected. For example, see RWSynchObject::setCancellation(RWCancellationState).

For information on changes in RWCancellationState and compatibility with previous versions of Threads.h++, please see the Threads Module User's Guide.

See also:
RWSynchObject
void rwServiceCancellation ( void   )  [related]

This function determines the calling thread's current runnable, if any, and calls RWRunnableSelf::serviceCancellation() on that runnable. If cancellation has been requested on the runnable object, then an RWCancellation exception is thrown.

Note that this function looks up the current runnable every time it is called. If you need to service cancellation repeatedly, e.g., within a loop, it is more efficient to call the global function rwRunnable() to get an RWRunnableSelf handle for the current runnable, and then call RWRunnableSelf::serviceCancellation() directly on this handle instance each time.

See also:
RWCancellation, RWRunnableSelf, rwRunnable()
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.