00001 #include "tao/Resume_Handle.h"
00002 #include "tao/ORB_Core.h"
00003 #include "debug.h"
00004
00005 #include "ace/Reactor.h"
00006
00007 #if !defined (__ACE_INLINE__)
00008 # include "tao/Resume_Handle.inl"
00009 #endif
00010
00011 ACE_RCSID (tao,
00012 Resume_Handle,
00013 "$Id: Resume_Handle.cpp 72071 2006-04-11 16:36:14Z zhangw $")
00014
00015
00016 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00017
00018 void
00019 TAO_Resume_Handle::resume_handle (void)
00020 {
00021
00022
00023 if (this->orb_core_ &&
00024 this->orb_core_->reactor ()->resumable_handler () &&
00025 this->flag_ == TAO_HANDLE_RESUMABLE &&
00026 this->handle_ != ACE_INVALID_HANDLE)
00027 {
00028 this->orb_core_->reactor ()->resume_handler (this->handle_);
00029 }
00030
00031
00032 this->flag_ = TAO_HANDLE_ALREADY_RESUMED;
00033 }
00034
00035 void
00036 TAO_Resume_Handle::handle_input_return_value_hook (int& return_value)
00037 {
00038
00039
00040
00041
00042
00043
00044
00045 if ( return_value == 1 &&
00046 this->flag_ == TAO_HANDLE_ALREADY_RESUMED &&
00047 this->orb_core_ &&
00048 this->orb_core_->reactor ()->resumable_handler () &&
00049 this->handle_ != ACE_INVALID_HANDLE)
00050 {
00051
00052
00053
00054 return_value = 0;
00055
00056 if (TAO_debug_level > 6)
00057 {
00058 ACE_DEBUG ((LM_DEBUG,
00059 "TAO (%P|%t) - Resume_Handle::handle_input_return_value_hook, "
00060 "overriding return value of 1 with retval = %d\n",
00061 return_value));
00062 }
00063 }
00064 else if ( return_value == -1 )
00065 {
00066
00067
00068
00069
00070 this->flag_ = TAO_HANDLE_LEAVE_SUSPENDED;
00071
00072 if (TAO_debug_level > 6)
00073 {
00074 ACE_DEBUG ((LM_DEBUG,
00075 "TAO (%P|%t) - Resume_Handle::handle_input_return_value_hook, "
00076 "handle_input returning -1, so handle is not resumed.\n"));
00077 }
00078 }
00079 }
00080
00081 TAO_END_VERSIONED_NAMESPACE_DECL