Public Member Functions | Private Types | Private Attributes

TAO::CSD::TP_Synch_Helper Class Reference

Helper class for synchronous requests to block the requesting thread until the appropriate time (when it will be un-blocked). More...

#include <CSD_TP_Synch_Helper.h>

Collaboration diagram for TAO::CSD::TP_Synch_Helper:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TP_Synch_Helper ()
 Constructor. Sets initial state to PENDING.
 ~TP_Synch_Helper ()
 Destructor.
bool wait_while_pending ()
void dispatched ()
void cancelled ()

Private Types

enum  HelperState { PENDING, DISPATCHED, CANCELLED }
 

Enumeration Type for all possible states of this helper object.

More...
typedef TAO_SYNCH_MUTEX LockType
 Thread lock type.
typedef ACE_Guard< LockType > GuardType
 Thread guard type.
typedef TAO_Condition< LockType > ConditionType
 Thread condition type.

Private Attributes

LockType lock_
 Lock used to protect the state and condition.
HelperState state_
 Used to denote the state of the request dispatching.
ConditionType condition_

Detailed Description

Helper class for synchronous requests to block the requesting thread until the appropriate time (when it will be un-blocked).

TBD - Description here

Definition at line 43 of file CSD_TP_Synch_Helper.h.


Member Typedef Documentation

typedef TAO_Condition<LockType> TAO::CSD::TP_Synch_Helper::ConditionType [private]

Thread condition type.

Definition at line 86 of file CSD_TP_Synch_Helper.h.

typedef ACE_Guard<LockType> TAO::CSD::TP_Synch_Helper::GuardType [private]

Thread guard type.

Definition at line 83 of file CSD_TP_Synch_Helper.h.

typedef TAO_SYNCH_MUTEX TAO::CSD::TP_Synch_Helper::LockType [private]

Thread lock type.

Definition at line 80 of file CSD_TP_Synch_Helper.h.


Member Enumeration Documentation

enum TAO::CSD::TP_Synch_Helper::HelperState [private]

Enumeration Type for all possible states of this helper object.

Enumerator:
PENDING 
DISPATCHED 
CANCELLED 

Definition at line 72 of file CSD_TP_Synch_Helper.h.

      {
        PENDING,
        DISPATCHED,
        CANCELLED
      };


Constructor & Destructor Documentation

TAO::CSD::TP_Synch_Helper::TP_Synch_Helper (  ) 

Constructor. Sets initial state to PENDING.

Definition at line 8 of file CSD_TP_Synch_Helper.inl.

  : state_(PENDING),
    condition_(this->lock_)
{
}

TAO::CSD::TP_Synch_Helper::~TP_Synch_Helper (  ) 

Destructor.

Definition at line 16 of file CSD_TP_Synch_Helper.inl.

{
}


Member Function Documentation

void TAO::CSD::TP_Synch_Helper::cancelled (  ) 

Change the state of this helper to CANCELLED, which will cause wait_while_pending() to unblock.

Definition at line 48 of file CSD_TP_Synch_Helper.inl.

{
  GuardType guard(this->lock_);
  this->state_ = CANCELLED;
  this->condition_.signal();
}

void TAO::CSD::TP_Synch_Helper::dispatched (  ) 

Change the state of this helper to DISPATCHED, which will cause wait_while_pending() to unblock.

Definition at line 38 of file CSD_TP_Synch_Helper.inl.

{
  GuardType guard(this->lock_);
  this->state_ = DISPATCHED;
  this->condition_.signal();
}

bool TAO::CSD::TP_Synch_Helper::wait_while_pending (  ) 

Returns true if the helper state is DISPATCHED, and false if the helper state is CANCELLED. However, if the helper state is PENDING, then this method will block the calling thread until the state changes to something other than PENDING (ie, DISPATCHED or CANCELLED).

Definition at line 23 of file CSD_TP_Synch_Helper.inl.

{
  GuardType guard(this->lock_);

  while (this->state_ == PENDING)
    {
      this->condition_.wait();
    }

  return (this->state_ == DISPATCHED);
}


Member Data Documentation

ConditionType TAO::CSD::TP_Synch_Helper::condition_ [private]

The condition used to block the calling thread until the state is something other than the PENDING state.

Definition at line 96 of file CSD_TP_Synch_Helper.h.

LockType TAO::CSD::TP_Synch_Helper::lock_ [private]

Lock used to protect the state and condition.

Definition at line 89 of file CSD_TP_Synch_Helper.h.

HelperState TAO::CSD::TP_Synch_Helper::state_ [private]

Used to denote the state of the request dispatching.

Definition at line 92 of file CSD_TP_Synch_Helper.h.


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