#include <Asynch_Pseudo_Task.h>
Inheritance diagram for ACE_Asynch_Pseudo_Task:
Public Member Functions | |
ACE_Asynch_Pseudo_Task () | |
virtual | ~ACE_Asynch_Pseudo_Task () |
int | start (void) |
int | stop (void) |
int | register_io_handler (ACE_HANDLE handle, ACE_Event_Handler *handler, ACE_Reactor_Mask mask, int flg_suspend) |
int | remove_io_handler (ACE_HANDLE handle) |
int | remove_io_handler (ACE_Handle_Set &set) |
int | resume_io_handler (ACE_HANDLE handle) |
int | suspend_io_handler (ACE_HANDLE handle) |
Protected Member Functions | |
virtual int | svc (void) |
Run by a daemon thread to handle deferred processing. | |
Protected Attributes | |
ACE_Select_Reactor | select_reactor_ |
Should be initialized before reactor_. | |
ACE_Reactor | reactor_ |
Pointer to the various event demultiplexors. |
Definition at line 41 of file Asynch_Pseudo_Task.h.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task | ( | ) |
Definition at line 12 of file Asynch_Pseudo_Task.cpp.
00013 : select_reactor_ (), // should be initialized before reactor_ 00014 reactor_ (&select_reactor_, 0) // don't delete implementation 00015 { 00016 }
ACE_Asynch_Pseudo_Task::~ACE_Asynch_Pseudo_Task | ( | ) | [virtual] |
Definition at line 18 of file Asynch_Pseudo_Task.cpp.
References stop().
00019 { 00020 this->stop (); 00021 }
int ACE_Asynch_Pseudo_Task::register_io_handler | ( | ACE_HANDLE | handle, | |
ACE_Event_Handler * | handler, | |||
ACE_Reactor_Mask | mask, | |||
int | flg_suspend | |||
) |
Definition at line 75 of file Asynch_Pseudo_Task.cpp.
References ACE_ERROR, ACE_TEXT, ACE_Event_Handler::ALL_EVENTS_MASK, ACE_Event_Handler::DONT_CALL, LM_ERROR, reactor_, and ACE_Reactor::remove_handler().
00079 { 00080 // Register the handler with the reactor. 00081 if (-1 == this->reactor_.register_handler (handle, handler, mask)) 00082 return -1; 00083 00084 if (flg_suspend == 0) 00085 return 0; 00086 00087 // Suspend the handle now. Enable only when the accept is issued 00088 // by the application. 00089 if (this->reactor_.suspend_handler (handle) == -1) 00090 { 00091 ACE_ERROR 00092 ((LM_ERROR, 00093 ACE_TEXT ("%N:%l:%p\n"), 00094 ACE_TEXT ("register_io_handler (suspended)"))); 00095 this->reactor_.remove_handler (handle, ACE_Event_Handler::ALL_EVENTS_MASK 00096 | ACE_Event_Handler::DONT_CALL); 00097 return -1; 00098 } 00099 00100 return 0; 00101 }
int ACE_Asynch_Pseudo_Task::remove_io_handler | ( | ACE_Handle_Set & | set | ) |
Definition at line 112 of file Asynch_Pseudo_Task.cpp.
References ACE_Event_Handler::ALL_EVENTS_MASK, ACE_Event_Handler::DONT_CALL, reactor_, and ACE_Reactor::remove_handler().
00113 { 00114 return this->reactor_.remove_handler (set, ACE_Event_Handler::ALL_EVENTS_MASK 00115 | ACE_Event_Handler::DONT_CALL); 00116 }
int ACE_Asynch_Pseudo_Task::remove_io_handler | ( | ACE_HANDLE | handle | ) |
Definition at line 104 of file Asynch_Pseudo_Task.cpp.
References ACE_Event_Handler::ALL_EVENTS_MASK, ACE_Event_Handler::DONT_CALL, reactor_, and ACE_Reactor::remove_handler().
00105 { 00106 return this->reactor_.remove_handler (handle, 00107 ACE_Event_Handler::ALL_EVENTS_MASK 00108 | ACE_Event_Handler::DONT_CALL); 00109 }
int ACE_Asynch_Pseudo_Task::resume_io_handler | ( | ACE_HANDLE | handle | ) |
Definition at line 125 of file Asynch_Pseudo_Task.cpp.
References reactor_, and ACE_Reactor::resume_handler().
00126 { 00127 return this->reactor_.resume_handler (handle); 00128 }
int ACE_Asynch_Pseudo_Task::start | ( | void | ) |
Definition at line 24 of file Asynch_Pseudo_Task.cpp.
References ACE_ERROR_RETURN, ACE_TEXT, ACE_Task_Base::activate(), and LM_ERROR.
00025 { 00026 if (this->reactor_.initialized () == 0) 00027 ACE_ERROR_RETURN ((LM_ERROR, 00028 ACE_TEXT ("%N:%l:%p\n"), 00029 ACE_TEXT ("start reactor is not initialized")), 00030 -1); 00031 00032 return this->activate () == -1 ? -1 : 0; // If started, return 0 00033 }
int ACE_Asynch_Pseudo_Task::stop | ( | void | ) |
Definition at line 36 of file Asynch_Pseudo_Task.cpp.
References ACE_Reactor::close(), reactor_, and ACE_Task_Base::wait().
Referenced by ~ACE_Asynch_Pseudo_Task().
00037 { 00038 if (this->thr_count () == 0) // already stopped 00039 return 0; 00040 00041 if (this->reactor_.end_reactor_event_loop () == -1) 00042 return -1; 00043 00044 this->wait (); 00045 this->reactor_.close (); 00046 return 0; 00047 }
int ACE_Asynch_Pseudo_Task::suspend_io_handler | ( | ACE_HANDLE | handle | ) |
Definition at line 119 of file Asynch_Pseudo_Task.cpp.
References reactor_, and ACE_Reactor::suspend_handler().
00120 { 00121 return this->reactor_.suspend_handler (handle); 00122 }
int ACE_Asynch_Pseudo_Task::svc | ( | void | ) | [protected, virtual] |
Run by a daemon thread to handle deferred processing.
Reimplemented from ACE_Task_Base.
Definition at line 50 of file Asynch_Pseudo_Task.cpp.
References ACE_ERROR, ACE_SIGRTMAX, ACE_SIGRTMIN, ACE_TEXT, LM_ERROR, ACE_Reactor::owner(), ACE_OS::pthread_sigmask(), reactor_, ACE_Reactor::run_reactor_event_loop(), ACE_Thread::self(), SIG_BLOCK, ACE_OS::sigaddset(), and ACE_OS::sigemptyset().
00051 { 00052 #if !defined (ACE_WIN32) 00053 00054 sigset_t RT_signals; 00055 00056 sigemptyset (&RT_signals); 00057 for (int si = ACE_SIGRTMIN; si <= ACE_SIGRTMAX; si++) 00058 sigaddset (&RT_signals, si); 00059 00060 if (ACE_OS::pthread_sigmask (SIG_BLOCK, &RT_signals, 0) != 0) 00061 ACE_ERROR ((LM_ERROR, 00062 ACE_TEXT ("Error:(%P | %t):%p\n"), 00063 ACE_TEXT ("pthread_sigmask"))); 00064 #endif 00065 00066 reactor_.owner (ACE_Thread::self ()); 00067 reactor_.run_reactor_event_loop (); 00068 00069 return 0; 00070 }
ACE_Reactor ACE_Asynch_Pseudo_Task::reactor_ [protected] |
Pointer to the various event demultiplexors.
Reimplemented from ACE_Event_Handler.
Definition at line 66 of file Asynch_Pseudo_Task.h.
Referenced by register_io_handler(), remove_io_handler(), resume_io_handler(), stop(), suspend_io_handler(), and svc().