#include <Wait_On_Reactor.h>
Inheritance diagram for TAO_Wait_On_Reactor:
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 |
Definition at line 33 of file Wait_On_Reactor.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Wait_On_Reactor::TAO_Wait_On_Reactor | ( | TAO_Transport * | transport | ) |
Constructor.
Definition at line 17 of file Wait_On_Reactor.cpp.
00018 : TAO_Wait_Strategy (transport) 00019 { 00020 }
TAO_Wait_On_Reactor::~TAO_Wait_On_Reactor | ( | void | ) | [virtual] |
bool TAO_Wait_On_Reactor::can_process_upcalls | ( | void | ) | const [virtual] |
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.
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.
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.
References TAO_Transport::register_handler(), and TAO_Wait_Strategy::transport_.
00100 { 00101 if (!this->is_registered_) 00102 { 00103 return this->transport_->register_handler (); 00104 } 00105 00106 return 1; 00107 }
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.
References TAO_LF_Invocation_Event::error_detected(), ACE_Reactor::handle_events(), TAO_LF_Event::keep_waiting(), TAO_Transport::orb_core(), TAO_ORB_Core::reactor(), TAO_LF_Invocation_Event::successful(), TAO_Wait_Strategy::transport_, and ACE_Time_Value::zero.
00029 { 00030 // Start the count down timer to account for the time spent in this 00031 // method. 00032 ACE_Countdown_Time countdown (max_wait_time); 00033 00034 // Reactor does not change inside the loop. 00035 ACE_Reactor *const reactor = 00036 this->transport_->orb_core ()->reactor (); 00037 00038 // Do the event loop, till we fully receive a reply. 00039 int result = 0; 00040 00041 while (1) 00042 { 00043 // Run the event loop. 00044 result = reactor->handle_events (max_wait_time); 00045 00046 // If we got our reply, no need to run the event loop any 00047 // further. 00048 if (!rd.keep_waiting ()) 00049 { 00050 break; 00051 } 00052 00053 // Did we timeout? If so, stop running the loop. 00054 if (result == 0 00055 && max_wait_time != 0 00056 && *max_wait_time == ACE_Time_Value::zero) 00057 { 00058 break; 00059 } 00060 00061 // Other errors? If so, stop running the loop. 00062 if (result == -1) 00063 { 00064 break; 00065 } 00066 00067 // Otherwise, keep going... 00068 } 00069 00070 if (result == -1 || rd.error_detected ()) 00071 { 00072 return -1; 00073 } 00074 00075 // Return an error if there was a problem receiving the reply. 00076 if (max_wait_time != 0) 00077 { 00078 if (rd.successful () && *max_wait_time == ACE_Time_Value::zero) 00079 { 00080 result = -1; 00081 errno = ETIME; 00082 } 00083 } 00084 else 00085 { 00086 result = 0; 00087 00088 if (rd.error_detected ()) 00089 { 00090 result = -1; 00091 } 00092 } 00093 00094 return result; 00095 }