ACE  6.0.6
Public Member Functions | Public Attributes | Private Attributes
ACE_Reactor_Token_T Class Reference

Used as a synchronization mechanism to coordinate concurrent access to an ACE_Reactor_Impl object. More...

#include <Reactor_Token_T.h>

Collaboration diagram for ACE_Reactor_Token_T:
Collaboration graph

List of all members.

Public Member Functions

 ACE_Reactor_Token_T (ACE_Reactor_Impl &r, int s_queue=ACE_TOKEN_TYPE::FIFO)
 ACE_Reactor_Token_T (int s_queue=ACE_TOKEN_TYPE::FIFO)
virtual ~ACE_Reactor_Token_T (void)
virtual void sleep_hook (void)
ACE_Reactor_Implreactor (void)
 Get the reactor implementation.
void reactor (ACE_Reactor_Impl &)
 Set the reactor implementation.
virtual void dump (void) const
 Dump the state of an object.

Public Attributes

 Declare the dynamic allocation hooks.

Private Attributes


Detailed Description

Used as a synchronization mechanism to coordinate concurrent access to an ACE_Reactor_Impl object.

For ACE internal use only.

This class is used to make access to a reactor's internals and demultiplexing mechanism thread-safe. By default, the thread that runs the handle_events() loop holds the token, even when it is blocked in the demultiplexer. Whenever another thread wants to access the reactor, such as via the register_handler(), remove_handler(), etc. methods, it must ask the token owner for temporary release of the token. To accomplish this, this class reimplements the ACE_Token::sleep_hook() method through which the owning thread can be notified to temporarily release the token if the current situation permits.

The owner of the token is responsible for deciding which request for the token can be granted. By using the ACE_Token::renew() method, the thread that releases the token temporarily can specify to get the token back right after the other thread has completed using the token. Thus, there is a dedicated thread that owns the token by default. This thread grants other threads access to the token by ensuring that whenever somebody else has finished using the token the original owner reclaims the token again, i.e., the owner has the chance to schedule other threads. The thread that most likely needs the token most of the time is the thread running the dispatch loop.

Constructor & Destructor Documentation

ACE_Reactor_Token_T::ACE_Reactor_Token_T ( ACE_Reactor_Impl r,
int  s_queue = ACE_TOKEN_TYPE::FIFO 
ACE_Reactor_Token_T::ACE_Reactor_Token_T ( int  s_queue = ACE_TOKEN_TYPE::FIFO)
ACE_Reactor_Token_T::~ACE_Reactor_Token_T ( void  ) [virtual]

Member Function Documentation

void ACE_Reactor_Token_T::dump ( void  ) const [virtual]

Dump the state of an object.

ACE_Reactor_Impl & ACE_Reactor_Token_T::reactor ( void  )

Get the reactor implementation.

void ACE_Reactor_Token_T::reactor ( ACE_Reactor_Impl reactor)

Set the reactor implementation.

void ACE_Reactor_Token_T::sleep_hook ( void  ) [virtual]

Called just before a token waiter goes to sleep.

See also:

Member Data Documentation

Declare the dynamic allocation hooks.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines