Public Member Functions

TAO_Wait_On_Reactor Class Reference

Wait on the Reactor. Happens in s Single Threaded client environment. More...

#include <Wait_On_Reactor.h>

Inheritance diagram for TAO_Wait_On_Reactor:
Inheritance graph
[legend]
Collaboration diagram for TAO_Wait_On_Reactor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TAO_Wait_On_Reactor (TAO_Transport *transport)
 Constructor.
virtual ~TAO_Wait_On_Reactor (void)
 Destructor.
virtual int wait (ACE_Time_Value *max_wait_time, TAO_Synch_Reply_Dispatcher &rd)
virtual int register_handler (void)
virtual bool non_blocking (void) const
virtual bool can_process_upcalls (void) const

Detailed Description

Wait on the Reactor. Happens in s Single Threaded client environment.

Definition at line 33 of file Wait_On_Reactor.h.


Constructor & Destructor Documentation

TAO_Wait_On_Reactor::TAO_Wait_On_Reactor ( TAO_Transport transport  ) 

Constructor.

Definition at line 17 of file Wait_On_Reactor.cpp.

  : TAO_Wait_Strategy (transport)
{
}

TAO_Wait_On_Reactor::~TAO_Wait_On_Reactor ( void   )  [virtual]

Destructor.

Definition at line 22 of file Wait_On_Reactor.cpp.

{
}


Member Function Documentation

bool TAO_Wait_On_Reactor::can_process_upcalls ( void   )  const [virtual]

Flag that indicates whether we can process requests while waiting for the reply. This flag is to check whether the thread can process upcalls while waiting for the reply. Some wait strategies, like Wait_On_LF_No_Upcall does not allow the client threads to process requests while waiting for the reply.

Implements TAO_Wait_Strategy.

Definition at line 116 of file Wait_On_Reactor.cpp.

{
  return true;
}

bool TAO_Wait_On_Reactor::non_blocking ( void   )  const [virtual]

Returns a value to indicate whether the transport needs to set the socket on which it is waiting to non-blocking mode or not.

Implements TAO_Wait_Strategy.

Definition at line 110 of file Wait_On_Reactor.cpp.

{
  return true;
}

int TAO_Wait_On_Reactor::register_handler ( void   )  [virtual]

Register the handler needs with the reactor provided that it makes sense for the strategy.

Implements TAO_Wait_Strategy.

Definition at line 99 of file Wait_On_Reactor.cpp.

{
  if (!this->is_registered_)
    {
      return this->transport_->register_handler ();
    }

  return 1;
}

int TAO_Wait_On_Reactor::wait ( ACE_Time_Value max_wait_time,
TAO_Synch_Reply_Dispatcher rd 
) [virtual]

Base class virtual method. Wait till the reply_received flag is true or the time expires.

Implements TAO_Wait_Strategy.

Definition at line 27 of file Wait_On_Reactor.cpp.

{
  // Start the count down timer to account for the time spent in this
  // method.
  ACE_Countdown_Time countdown (max_wait_time);

  // Reactor does not change inside the loop.
  ACE_Reactor *const reactor =
    this->transport_->orb_core ()->reactor ();

  // Do the event loop, till we fully receive a reply.
  int result = 0;

  while (1)
    {
      // Run the event loop.
      result = reactor->handle_events (max_wait_time);

      // If we got our reply, no need to run the event loop any
      // further.
      if (!rd.keep_waiting ())
        {
          break;
        }

      // Did we timeout? If so, stop running the loop.
      if (result == 0
          && max_wait_time != 0
          && *max_wait_time == ACE_Time_Value::zero)
        {
          break;
        }

      // Other errors? If so, stop running the loop.
      if (result == -1)
        {
          break;
        }

      // Otherwise, keep going...
    }

  if (result == -1 || rd.error_detected ())
    {
      return -1;
    }

  // Return an error if there was a problem receiving the reply.
  if (max_wait_time != 0)
    {
      if (rd.successful () && *max_wait_time == ACE_Time_Value::zero)
        {
          result = -1;
          errno = ETIME;
        }
    }
  else
    {
      result = 0;

      if (rd.error_detected ())
        {
          result = -1;
        }
    }

  return result;
}


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