#include <Proactor.h>
Collaboration diagram for ACE_Proactor:
Public Types | |
typedef ACE_Timer_Queue_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX > | TIMER_QUEUE |
Public type. | |
typedef int(* | PROACTOR_EVENT_HOOK )(ACE_Proactor *) |
Public Member Functions | |
ACE_Proactor (ACE_Proactor_Impl *implementation=0, int delete_implementation=0, TIMER_QUEUE *tq=0) | |
~ACE_Proactor (void) | |
Destruction. | |
int | close (void) |
Close the associated ACE_Proactor_Impl implementation object. | |
int | proactor_run_event_loop (PROACTOR_EVENT_HOOK=0) |
int | proactor_run_event_loop (ACE_Time_Value &tv, PROACTOR_EVENT_HOOK=0) |
int | proactor_end_event_loop (void) |
int | proactor_event_loop_done (void) |
Report if the ACE_Proactor event loop is finished. | |
int | proactor_reset_event_loop (void) |
int | register_handle (ACE_HANDLE handle, const void *completion_key) |
long | schedule_timer (ACE_Handler &handler, const void *act, const ACE_Time_Value &time) |
long | schedule_repeating_timer (ACE_Handler &handler, const void *act, const ACE_Time_Value &interval) |
long | schedule_timer (ACE_Handler &handler, const void *act, const ACE_Time_Value &time, const ACE_Time_Value &interval) |
int | cancel_timer (ACE_Handler &handler, int dont_call_handle_close=1) |
int | cancel_timer (long timer_id, const void **act=0, int dont_call_handle_close=1) |
int | handle_events (ACE_Time_Value &wait_time) |
int | handle_events (void) |
int | wake_up_dispatch_threads (void) |
Add wakeup dispatch threads (reinit). | |
int | close_dispatch_threads (int wait) |
Close all dispatch threads. | |
size_t | number_of_threads (void) const |
Get number of thread used as a parameter to CreatIoCompletionPort. | |
void | number_of_threads (size_t threads) |
Set number of thread used as a parameter to CreatIoCompletionPort. | |
TIMER_QUEUE * | timer_queue (void) const |
Get timer queue. | |
void | timer_queue (TIMER_QUEUE *timer_queue) |
Set timer queue. | |
ACE_HANDLE | get_handle (void) const |
ACE_Proactor_Impl * | implementation (void) const |
Get the implementation class. | |
ACE_Asynch_Read_Stream_Impl * | create_asynch_read_stream (void) |
ACE_Asynch_Write_Stream_Impl * | create_asynch_write_stream (void) |
ACE_Asynch_Read_File_Impl * | create_asynch_read_file (void) |
ACE_Asynch_Write_File_Impl * | create_asynch_write_file (void) |
ACE_Asynch_Accept_Impl * | create_asynch_accept (void) |
Create the correct implementation class for doing Asynch_Accept. | |
ACE_Asynch_Connect_Impl * | create_asynch_connect (void) |
Create the correct implementation class for doing Asynch_Connect. | |
ACE_Asynch_Transmit_File_Impl * | create_asynch_transmit_file (void) |
ACE_Asynch_Read_Dgram_Impl * | create_asynch_read_dgram (void) |
ACE_Asynch_Write_Dgram_Impl * | create_asynch_write_dgram (void) |
ACE_Asynch_Read_Stream_Result_Impl * | create_asynch_read_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, u_long bytes_to_read, const void *act, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
ACE_Asynch_Write_Stream_Result_Impl * | create_asynch_write_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, u_long bytes_to_write, const void *act, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
ACE_Asynch_Read_File_Result_Impl * | create_asynch_read_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, u_long bytes_to_read, const void *act, u_long offset, u_long offset_high, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
ACE_Asynch_Write_File_Result_Impl * | create_asynch_write_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, u_long bytes_to_write, const void *act, u_long offset, u_long offset_high, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
ACE_Asynch_Read_Dgram_Result_Impl * | create_asynch_read_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_read, int flags, int protocol_family, const void *act, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
ACE_Asynch_Write_Dgram_Result_Impl * | create_asynch_write_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, size_t bytes_to_write, int flags, const void *act, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
ACE_Asynch_Accept_Result_Impl * | create_asynch_accept_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, ACE_Message_Block &message_block, u_long bytes_to_read, const void *act, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
Create the correct implementation class for ACE_Asynch_Accept::Result. | |
ACE_Asynch_Connect_Result_Impl * | create_asynch_connect_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void *act, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
Create the correct implementation class for ACE_Asynch_Connect::Result. | |
ACE_Asynch_Transmit_File_Result_Impl * | create_asynch_transmit_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, u_long bytes_to_write, u_long offset, u_long offset_high, u_long bytes_per_send, u_long flags, const void *act, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
ACE_Asynch_Result_Impl * | create_asynch_timer (ACE_Handler::Proxy_Ptr &handler_proxy, const void *act, const ACE_Time_Value &tv, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN) |
Static Public Member Functions | |
ACE_Proactor * | instance (size_t threads=0) |
ACE_Proactor * | instance (ACE_Proactor *proactor, int delete_proactor=0) |
void | close_singleton (void) |
Delete the dynamically allocated Singleton. | |
void | cleanup (void *instance, void *arg) |
const ACE_TCHAR * | dll_name (void) |
Name of dll in which the singleton instance lives. | |
const ACE_TCHAR * | name (void) |
Name of component--ACE_Proactor in this case. | |
int | run_event_loop (void) |
int | run_event_loop (ACE_Time_Value &tv) |
int | end_event_loop (void) |
int | reset_event_loop (void) |
int | check_reconfiguration (ACE_Proactor *) |
int | event_loop_done (void) |
Report if the <ACE_Proactor::instance> event loop is finished. | |
Protected Member Functions | |
int | proactor_post_wakeup_completions (int how_many) |
void | implementation (ACE_Proactor_Impl *implementation) |
Set the implementation class. | |
Static Protected Member Functions | |
int | post_wakeup_completions (int how_many) |
Protected Attributes | |
ACE_Proactor_Impl * | implementation_ |
int | delete_implementation_ |
ACE_Proactor_Timer_Handler * | timer_handler_ |
Handles timeout events. | |
ACE_Thread_Manager | thr_mgr_ |
This will manage the thread in the Timer_Handler. | |
TIMER_QUEUE * | timer_queue_ |
Timer Queue. | |
int | delete_timer_queue_ |
Flag on whether to delete the timer queue. | |
sig_atomic_t | end_event_loop_ |
Terminate the proactor event loop. | |
sig_atomic_t | event_loop_thread_count_ |
Number of threads in the event loop. | |
ACE_SYNCH_MUTEX | mutex_ |
Mutex to protect work with lists. | |
Static Protected Attributes | |
ACE_Proactor * | proactor_ = 0 |
Pointer to a process-wide . | |
int | delete_proactor_ = 0 |
Must delete the if non-0. | |
Private Types | |
typedef ACE_Timer_Queue_Iterator_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX > | TIMER_QUEUE_ITERATOR |
typedef ACE_Timer_List_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX > | TIMER_LIST |
typedef ACE_Timer_List_Iterator_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX > | TIMER_LIST_ITERATOR |
typedef ACE_Timer_Heap_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX > | TIMER_HEAP |
typedef ACE_Timer_Heap_Iterator_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX > | TIMER_HEAP_ITERATOR |
typedef ACE_Timer_Wheel_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX > | TIMER_WHEEL |
typedef ACE_Timer_Wheel_Iterator_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX > | TIMER_WHEEL_ITERATOR |
Private Member Functions | |
ACE_Proactor (const ACE_Proactor &) | |
Deny access since member-wise won't work... | |
ACE_Proactor & | operator= (const ACE_Proactor &) |
Friends | |
class | ACE_Proactor_Timer_Handler |
See the Proactor pattern description at http://www.cs.wustl.edu/~schmidt/proactor.ps.gz for more details.
Definition at line 134 of file Proactor.h.
|
You can add a hook to various run_event methods and the hook will be called after handling every proactor event. If this function returns 0, proactor_run_event_loop will check for the return value of handle_events. If it is -1, the the proactor_run_event_loop will return (pre-maturely.) Definition at line 266 of file Proactor.h. Referenced by proactor_run_event_loop(). |
|
Definition at line 153 of file Proactor.h. Referenced by timer_queue(). |
|
Definition at line 157 of file Proactor.h. |
|
Definition at line 145 of file Proactor.h. |
|
Definition at line 149 of file Proactor.h. |
|
Public type.
Definition at line 178 of file Proactor.h. |
|
Definition at line 141 of file Proactor.h. |
|
Definition at line 161 of file Proactor.h. |
|
Definition at line 165 of file Proactor.h. |
|
Constructor. If is 0, the correct implementation object will be created. flag determines whether the implementation object should be deleted by the Proactor or not. If is 0, a new TIMER_QUEUE is created. Definition at line 300 of file Proactor.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_NEW, ACE_Task_Base::activate(), implementation(), LM_ERROR, timer_handler_, and timer_queue().
00303 : implementation_ (0), 00304 delete_implementation_ (delete_implementation), 00305 timer_handler_ (0), 00306 timer_queue_ (0), 00307 delete_timer_queue_ (0), 00308 end_event_loop_ (0), 00309 event_loop_thread_count_ (0) 00310 { 00311 this->implementation (implementation); 00312 00313 if (this->implementation () == 0) 00314 { 00315 #if defined (ACE_HAS_AIO_CALLS) 00316 // POSIX Proactor. 00317 # if defined (ACE_POSIX_AIOCB_PROACTOR) 00318 ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor); 00319 # elif defined (ACE_POSIX_SIG_PROACTOR) 00320 ACE_NEW (implementation, ACE_POSIX_SIG_Proactor); 00321 # else /* Default order: CB (but not Lynx), SIG, AIOCB */ 00322 # if !defined (__Lynx) && !defined (__FreeBSD__) 00323 ACE_NEW (implementation, ACE_POSIX_CB_Proactor); 00324 # else 00325 # if defined(ACE_HAS_POSIX_REALTIME_SIGNALS) 00326 ACE_NEW (implementation, ACE_POSIX_SIG_Proactor); 00327 # else 00328 ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor); 00329 # endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */ 00330 # endif /* !__Lynx && !__FreeBSD__ */ 00331 # endif /* ACE_POSIX_AIOCB_PROACTOR */ 00332 #elif (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) 00333 // WIN_Proactor. 00334 ACE_NEW (implementation, 00335 ACE_WIN32_Proactor); 00336 #endif /* ACE_HAS_AIO_CALLS */ 00337 this->implementation (implementation); 00338 this->delete_implementation_ = 1; 00339 } 00340 00341 // Set the timer queue. 00342 this->timer_queue (tq); 00343 00344 // Create the timer handler 00345 ACE_NEW (this->timer_handler_, 00346 ACE_Proactor_Timer_Handler (*this)); 00347 00348 // Activate <timer_handler>. 00349 if (this->timer_handler_->activate (THR_NEW_LWP) == -1) 00350 ACE_ERROR ((LM_ERROR, 00351 ACE_LIB_TEXT ("%N:%l:(%P | %t):%p\n"), 00352 ACE_LIB_TEXT ("Task::activate:could not create thread\n"))); 00353 } |
|
Destruction.
Definition at line 355 of file Proactor.cpp. References close().
00356 { 00357 this->close (); 00358 } |
|
Deny access since member-wise won't work...
|
|
Cancel the single that matches the value (which was returned from the method). If is non-NULL then it will be set to point to the ``magic cookie'' argument passed in when the was registered. This makes it possible to free up the memory and avoid memory leaks. Returns 1 if cancellation succeeded and 0 if the wasn't found. Definition at line 704 of file Proactor.cpp.
00707 { 00708 // No need to singal timer event here. Even if the cancel timer was 00709 // the earliest, we will have an extra wakeup. 00710 return this->timer_queue_->cancel (timer_id, 00711 arg, 00712 dont_call_handle_close); 00713 } |
|
Cancel all timers associated with this . Returns number of timers cancelled. Definition at line 716 of file Proactor.cpp.
00718 { 00719 // No need to signal timer event here. Even if the cancel timer was 00720 // the earliest, we will have an extra wakeup. 00721 return this->timer_queue_->cancel (&handler, 00722 dont_call_handle_close); 00723 } |
|
The singleton proactor is used by the ACE_Service_Config. Therefore, we must check for the reconfiguration request and handle it after handling an event. Definition at line 432 of file Proactor.cpp. References ACE_Service_Config::reconfig_occurred(), and ACE_Service_Config::reconfigure(). Referenced by run_event_loop().
00433 { 00434 #if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_SVCCONF) 00435 if (ACE_Service_Config::reconfig_occurred ()) 00436 { 00437 ACE_Service_Config::reconfigure (); 00438 return 1; 00439 } 00440 #endif /* ! ACE_HAS_WINCE || ! ACE_LACKS_ACE_SVCCONF */ 00441 return 0; 00442 } |
|
Cleanup method, used by the to destroy the singleton. |
|
Close the associated If
Definition at line 602 of file Proactor.cpp. References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_Proactor_Impl::close(), implementation(), LM_ERROR, and timer_handler_. Referenced by ~ACE_Proactor().
00603 { 00604 // Close the implementation. 00605 if (this->implementation ()->close () == -1) 00606 ACE_ERROR_RETURN ((LM_ERROR, 00607 ACE_LIB_TEXT ("%N:%l:(%P | %t):%p\n"), 00608 ACE_LIB_TEXT ("ACE_Proactor::close:implementation couldnt be closed")), 00609 -1); 00610 00611 // Delete the implementation. 00612 if (this->delete_implementation_) 00613 { 00614 delete this->implementation (); 00615 this->implementation_ = 0; 00616 } 00617 00618 // Delete the timer handler. 00619 if (this->timer_handler_) 00620 { 00621 delete this->timer_handler_; 00622 this->timer_handler_ = 0; 00623 } 00624 00625 // Delete the timer queue. 00626 if (this->delete_timer_queue_) 00627 { 00628 delete this->timer_queue_; 00629 this->timer_queue_ = 0; 00630 this->delete_timer_queue_ = 0; 00631 } 00632 00633 return 0; 00634 } |
|
Close all dispatch threads.
Definition at line 744 of file Proactor.cpp.
00745 {
00746 return 0;
00747 }
|
|
Delete the dynamically allocated Singleton.
Definition at line 403 of file Proactor.cpp. References ACE_GUARD, ACE_TRACE, delete_proactor_, and proactor_.
00404 { 00405 ACE_TRACE ("ACE_Proactor::close_singleton"); 00406 00407 ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, 00408 *ACE_Static_Object_Lock::instance ())); 00409 00410 if (ACE_Proactor::delete_proactor_) 00411 { 00412 00413 delete ACE_Proactor::proactor_; 00414 ACE_Proactor::proactor_ = 0; 00415 ACE_Proactor::delete_proactor_ = 0; 00416 } 00417 } |
|
Create the correct implementation class for doing Asynch_Accept.
Definition at line 844 of file Proactor.cpp. References ACE_Proactor_Impl::create_asynch_accept(), and implementation(). Referenced by ACE_Asynch_Accept::open().
00845 { 00846 return this->implementation ()->create_asynch_accept (); 00847 } |
|
Create the correct implementation class for ACE_Asynch_Accept::Result.
Definition at line 1010 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr.
01019 { 01020 return this->implementation ()->create_asynch_accept_result 01021 (handler_proxy, 01022 listen_handle, 01023 accept_handle, 01024 message_block, 01025 bytes_to_read, 01026 act, 01027 event, 01028 priority, 01029 signal_number); 01030 } |
|
Create the correct implementation class for doing Asynch_Connect.
Definition at line 850 of file Proactor.cpp. References ACE_Proactor_Impl::create_asynch_connect(), and implementation(). Referenced by ACE_Asynch_Connect::open().
00851 { 00852 return this->implementation ()->create_asynch_connect (); 00853 } |
|
Create the correct implementation class for ACE_Asynch_Connect::Result.
Definition at line 1034 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr.
01040 { 01041 return this->implementation ()->create_asynch_connect_result 01042 (handler_proxy, 01043 connect_handle, 01044 act, 01045 event, 01046 priority, 01047 signal_number); 01048 } |
|
Create the correct implementation class for doing Asynch_Read_Dgram. Definition at line 820 of file Proactor.cpp. References ACE_Proactor_Impl::create_asynch_read_dgram(), and implementation(). Referenced by ACE_Asynch_Read_Dgram::open().
00821 { 00822 return this->implementation ()->create_asynch_read_dgram (); 00823 } |
|
Create the correct implementation class for ACE_Asynch_Read_Dgram::Result. Definition at line 960 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr.
00970 { 00971 return this->implementation()->create_asynch_read_dgram_result 00972 (handler_proxy, 00973 handle, 00974 message_block, 00975 bytes_to_read, 00976 flags, 00977 protocol_family, 00978 act, 00979 event, 00980 priority, 00981 signal_number); 00982 } |
|
Create the correct implementation class for doing Asynch_Read_File. Definition at line 832 of file Proactor.cpp. References ACE_Proactor_Impl::create_asynch_read_file(), and implementation(). Referenced by ACE_Asynch_Read_File::open().
00833 { 00834 return this->implementation ()->create_asynch_read_file (); 00835 } |
|
Create the correct implementation class for ACE_Asynch_Read_File::Result. Definition at line 908 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr.
00918 { 00919 return this->implementation ()->create_asynch_read_file_result 00920 (handler_proxy, 00921 handle, 00922 message_block, 00923 bytes_to_read, 00924 act, 00925 offset, 00926 offset_high, 00927 event, 00928 priority, 00929 signal_number); 00930 } |
|
Create the correct implementation class for doing Asynch_Read_Stream. Definition at line 808 of file Proactor.cpp. References ACE_Proactor_Impl::create_asynch_read_stream(), and implementation(). Referenced by ACE_Asynch_Read_Stream::open().
00809 { 00810 return this->implementation ()->create_asynch_read_stream (); 00811 } |
|
Create the correct implementation class for ACE_Asynch_Read_Stream::Result class. Definition at line 863 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr.
00871 { 00872 return this->implementation ()->create_asynch_read_stream_result 00873 (handler_proxy, 00874 handle, 00875 message_block, 00876 bytes_to_read, 00877 act, 00878 event, 00879 priority, 00880 signal_number); 00881 } |
|
Create a timer result object which can be used with the Timer mechanism of the Proactor. If is -1, will create a Timer object with a meaningful signal number, choosing the largest signal number from the signal mask of the Proactor. Definition at line 1084 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr. Referenced by ACE_Proactor_Handle_Timeout_Upcall::timeout().
01090 { 01091 return this->implementation ()->create_asynch_timer 01092 (handler_proxy, 01093 act, 01094 tv, 01095 event, 01096 priority, 01097 signal_number); 01098 } |
|
Create the correct implementation class for doing Asynch_Transmit_File. Definition at line 856 of file Proactor.cpp. References ACE_Proactor_Impl::create_asynch_transmit_file(), and implementation(). Referenced by ACE_Asynch_Transmit_File::open().
00857 { 00858 return this->implementation ()->create_asynch_transmit_file (); 00859 } |
|
Create the correct implementation class for ACE_Asynch_Transmit_File::Result. Definition at line 1052 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr.
01065 { 01066 return this->implementation ()->create_asynch_transmit_file_result 01067 (handler_proxy, 01068 socket, 01069 file, 01070 header_and_trailer, 01071 bytes_to_write, 01072 offset, 01073 offset_high, 01074 bytes_per_send, 01075 flags, 01076 act, 01077 event, 01078 priority, 01079 signal_number); 01080 } |
|
Create the correct implementation class for doing Asynch_Write_Dgram. Definition at line 826 of file Proactor.cpp. References ACE_Proactor_Impl::create_asynch_write_dgram(), and implementation(). Referenced by ACE_Asynch_Write_Dgram::open().
00827 { 00828 return this->implementation ()->create_asynch_write_dgram (); 00829 } |
|
Create the correct implementation class for ACE_Asynch_Write_Dgram::Result. Definition at line 986 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr.
00995 { 00996 return this->implementation()->create_asynch_write_dgram_result 00997 (handler_proxy, 00998 handle, 00999 message_block, 01000 bytes_to_write, 01001 flags, 01002 act, 01003 event, 01004 priority, 01005 signal_number); 01006 } |
|
Create the correct implementation class for doing Asynch_Write_File. Definition at line 838 of file Proactor.cpp. References ACE_Proactor_Impl::create_asynch_write_file(), and implementation(). Referenced by ACE_Asynch_Write_File::open().
00839 { 00840 return this->implementation ()->create_asynch_write_file (); 00841 } |
|
Create the correct implementation class for ACE_Asynch_Write_File::Result. Definition at line 934 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr.
00944 { 00945 return this->implementation ()->create_asynch_write_file_result 00946 (handler_proxy, 00947 handle, 00948 message_block, 00949 bytes_to_write, 00950 act, 00951 offset, 00952 offset_high, 00953 event, 00954 priority, 00955 signal_number); 00956 } |
|
Create the correct implementation class for doing Asynch_Write_Stream. Definition at line 814 of file Proactor.cpp. References ACE_Proactor_Impl::create_asynch_write_stream(), and implementation(). Referenced by ACE_Asynch_Write_Stream::open().
00815 { 00816 return this->implementation ()->create_asynch_write_stream (); 00817 } |
|
Create the correct implementation class for ACE_Asynch_Write_Stream::Result. Definition at line 886 of file Proactor.cpp. References ACE_Handler::Proxy_Ptr.
00894 { 00895 return this->implementation ()->create_asynch_write_stream_result 00896 (handler_proxy, 00897 handle, 00898 message_block, 00899 bytes_to_write, 00900 act, 00901 event, 00902 priority, 00903 signal_number); 00904 } |
|
Name of dll in which the singleton instance lives.
Definition at line 420 of file Proactor.cpp. References ACE_LIB_TEXT.
00421 { 00422 return ACE_LIB_TEXT ("ACE"); 00423 } |
|
Instruct the <ACE_Proactor::instance> to terminate its event loop. This method wakes up all the threads blocked on waiting for completions and end the event loop. Definition at line 45 of file Proactor.inl. References ACE_TRACE, instance(), and proactor_end_event_loop().
00046 { 00047 ACE_TRACE ("ACE_Proactor::end_event_loop"); 00048 ACE_Proactor * const p = ACE_Proactor::instance (); 00049 00050 if (p == 0) 00051 return -1; 00052 00053 return p->proactor_end_event_loop (); 00054 } |
|
Report if the <ACE_Proactor::instance> event loop is finished.
Definition at line 57 of file Proactor.inl. References ACE_TRACE, instance(), and proactor_event_loop_done().
00058 { 00059 ACE_TRACE ("ACE_Proactor::event_loop_done"); 00060 ACE_Proactor * const p = ACE_Proactor::instance (); 00061 00062 if (p == 0) 00063 return -1; 00064 00065 return p->proactor_event_loop_done (); 00066 } |
|
Get the event handle. It is a no-op in POSIX platforms and it returns ACE_INVALID_HANDLE. Definition at line 795 of file Proactor.cpp. References ACE_Proactor_Impl::get_handle(), and implementation().
00796 { 00797 return this->implementation ()->get_handle (); 00798 } |
|
Block indefinitely until at least one event is dispatched.
Definition at line 732 of file Proactor.cpp. References ACE_Proactor_Impl::handle_events(), and implementation(). Referenced by proactor_run_event_loop().
00733 { 00734 return this->implementation ()->handle_events (); 00735 } |
|
Dispatch a single set of events, waiting up to a specified time limit if necessary.
Definition at line 726 of file Proactor.cpp. References ACE_Proactor_Impl::handle_events(), and implementation().
00727 { 00728 return implementation ()->handle_events (wait_time); 00729 } |
|
Set the implementation class.
Definition at line 1107 of file Proactor.cpp.
01108 { 01109 this->implementation_ = implementation; 01110 } |
|
Get the implementation class.
Definition at line 801 of file Proactor.cpp. Referenced by ACE_Proactor(), close(), create_asynch_accept(), create_asynch_connect(), create_asynch_read_dgram(), create_asynch_read_file(), create_asynch_read_stream(), create_asynch_transmit_file(), create_asynch_write_dgram(), create_asynch_write_file(), create_asynch_write_stream(), get_handle(), handle_events(), number_of_threads(), proactor_post_wakeup_completions(), register_handle(), and ACE_Proactor_Handle_Timeout_Upcall::timeout().
00802 { 00803 return this->implementation_; 00804 } |
|
Set pointer to a process-wide and return existing pointer. Definition at line 386 of file Proactor.cpp. References ACE_GUARD_RETURN, ACE_REGISTER_FRAMEWORK_COMPONENT, ACE_TRACE, delete_proactor_, and proactor_.
00387 { 00388 ACE_TRACE ("ACE_Proactor::instance"); 00389 00390 ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, 00391 *ACE_Static_Object_Lock::instance (), 0)); 00392 00393 ACE_Proactor *t = ACE_Proactor::proactor_; 00394 00395 ACE_Proactor::delete_proactor_ = delete_proactor; 00396 ACE_Proactor::proactor_ = r; 00397 ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_); 00398 00399 return t; 00400 } |
|
Get pointer to a process-wide . should be part of another method. Definition at line 361 of file Proactor.cpp. References ACE_GUARD_RETURN, ACE_NEW_RETURN, ACE_REGISTER_FRAMEWORK_COMPONENT, ACE_TRACE, delete_proactor_, and proactor_. Referenced by end_event_loop(), event_loop_done(), ACE_Asynch_Operation::get_proactor(), ACE_POSIX_Asynch_Operation::open(), post_wakeup_completions(), reset_event_loop(), and run_event_loop().
00362 { 00363 ACE_TRACE ("ACE_Proactor::instance"); 00364 00365 if (ACE_Proactor::proactor_ == 0) 00366 { 00367 // Perform Double-Checked Locking Optimization. 00368 ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, 00369 *ACE_Static_Object_Lock::instance (), 00370 0)); 00371 00372 if (ACE_Proactor::proactor_ == 0) 00373 { 00374 ACE_NEW_RETURN (ACE_Proactor::proactor_, 00375 ACE_Proactor, 00376 0); 00377 00378 ACE_Proactor::delete_proactor_ = 1; 00379 ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_); 00380 } 00381 } 00382 return ACE_Proactor::proactor_; 00383 } |
|
Name of component--ACE_Proactor in this case.
Definition at line 426 of file Proactor.cpp. References ACE_LIB_TEXT.
00427 { 00428 return ACE_LIB_TEXT ("ACE_Proactor"); 00429 } |
|
Set number of thread used as a parameter to CreatIoCompletionPort.
Definition at line 756 of file Proactor.cpp. References implementation(), and ACE_Proactor_Impl::number_of_threads().
00757 { 00758 this->implementation ()->number_of_threads (threads); 00759 } |
|
Get number of thread used as a parameter to CreatIoCompletionPort.
Definition at line 750 of file Proactor.cpp. References implementation(), and ACE_Proactor_Impl::number_of_threads().
00751 { 00752 return this->implementation ()->number_of_threads (); 00753 } |
|
|
|
Post completions to the completion port so that all threads can wake up. This is used in conjunction with the . Definition at line 69 of file Proactor.inl. References ACE_TRACE, instance(), and proactor_post_wakeup_completions().
00070 { 00071 ACE_TRACE ("ACE_Proactor::post_wakeup_completions"); 00072 ACE_Proactor * const p = ACE_Proactor::instance (); 00073 00074 if (p == 0) 00075 return -1; 00076 00077 return p->proactor_post_wakeup_completions (how_many); 00078 } |
|
Instruct the ACE_Proactor to terminate its event loop and notifies the ACE_Proactor so that it can wake up and close down gracefully. Definition at line 566 of file Proactor.cpp. References ACE_GUARD_RETURN, ACE_TRACE, end_event_loop_, event_loop_thread_count_, and proactor_post_wakeup_completions(). Referenced by end_event_loop().
00567 { 00568 ACE_TRACE ("ACE_Proactor::proactor_end_event_loop"); 00569 00570 int how_many = 0; 00571 00572 { 00573 // Obtain the lock, set the end flag and post the wakeup 00574 // completions. 00575 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); 00576 00577 // Set the end flag. 00578 this->end_event_loop_ = 1; 00579 00580 // Number of completions to post. 00581 how_many = this->event_loop_thread_count_; 00582 if (how_many == 0) 00583 return 0; 00584 } 00585 00586 // Post completions to all the threads so that they will all wake 00587 // up. 00588 return this->proactor_post_wakeup_completions (how_many); 00589 } |
|
Report if the ACE_Proactor event loop is finished.
Definition at line 592 of file Proactor.cpp. References ACE_GUARD_RETURN, ACE_TRACE, and end_event_loop_. Referenced by event_loop_done().
00593 { 00594 ACE_TRACE ("ACE_Proactor::proactor_event_loop_done"); 00595 00596 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); 00597 00598 return this->end_event_loop_ != 0 ? 1 : 0 ; 00599 } |
|
Post completions to the completion port so that all threads can wake up. This is used in conjunction with the . Definition at line 1101 of file Proactor.cpp. References implementation(), and ACE_Proactor_Impl::post_wakeup_completions(). Referenced by post_wakeup_completions(), proactor_end_event_loop(), and proactor_run_event_loop().
01102 { 01103 return this->implementation ()->post_wakeup_completions (how_many); 01104 } |
|
Resets the <ACE_Proactor::end_event_loop_> static so that the method can be restarted. Definition at line 554 of file Proactor.cpp. References ACE_GUARD_RETURN, ACE_TRACE, and end_event_loop_. Referenced by reset_event_loop().
00555 { 00556 ACE_TRACE ("ACE_Proactor::proactor_reset_event_loop"); 00557 00558 // Obtain the lock in the MT environments. 00559 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); 00560 00561 this->end_event_loop_ = 0; 00562 return 0; 00563 } |
|
Run the event loop until the <ACE_Proactor::handle_events> method returns -1, the method is invoked, or the expires, in which case a 0 is returned. Definition at line 500 of file Proactor.cpp. References ACE_GUARD_RETURN, ACE_TRACE, end_event_loop_, event_loop_thread_count_, handle_events(), PROACTOR_EVENT_HOOK, and proactor_post_wakeup_completions().
00502 { 00503 ACE_TRACE ("ACE_Proactor::proactor_run_event_loop"); 00504 int result = 0; 00505 00506 { 00507 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); 00508 00509 // Early check. It is ok to do this without lock, since we care just 00510 // whether it is zero or non-zero. 00511 if (this->end_event_loop_ != 0 00512 || tv == ACE_Time_Value::zero) 00513 return 0; 00514 00515 // First time you are in. Increment the thread count. 00516 this->event_loop_thread_count_ ++; 00517 } 00518 00519 // Run the event loop. 00520 for (;;) 00521 { 00522 // Check the end loop flag. It is ok to do this without lock, 00523 // since we care just whether it is zero or non-zero. 00524 if (this->end_event_loop_ != 0) 00525 break; 00526 00527 // <end_event_loop> is not set. Ready to do <handle_events>. 00528 result = this->handle_events (tv); 00529 00530 if (eh != 0 && (*eh) (this)) 00531 continue; 00532 00533 if (result == -1 || result == 0) 00534 break; 00535 } 00536 00537 // Leaving the event loop. Decrement the thread count. 00538 00539 { 00540 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); 00541 00542 // Decrement the thread count. 00543 this->event_loop_thread_count_ --; 00544 00545 if (this->event_loop_thread_count_ > 0 00546 && this->end_event_loop_ != 0) 00547 this->proactor_post_wakeup_completions (1); 00548 } 00549 00550 return result; 00551 } |
|
Run the event loop until the <ACE_Proactor::handle_events> method returns -1 or the method is invoked. Definition at line 445 of file Proactor.cpp. References ACE_GUARD_RETURN, ACE_TRACE, end_event_loop_, event_loop_thread_count_, handle_events(), PROACTOR_EVENT_HOOK, and proactor_post_wakeup_completions(). Referenced by run_event_loop().
00446 { 00447 ACE_TRACE ("ACE_Proactor::proactor_run_event_loop"); 00448 int result = 0; 00449 00450 { 00451 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); 00452 00453 // Early check. It is ok to do this without lock, since we care just 00454 // whether it is zero or non-zero. 00455 if (this->end_event_loop_ != 0) 00456 return 0; 00457 00458 // First time you are in. Increment the thread count. 00459 this->event_loop_thread_count_ ++; 00460 } 00461 00462 // Run the event loop. 00463 for (;;) 00464 { 00465 // Check the end loop flag. It is ok to do this without lock, 00466 // since we care just whether it is zero or non-zero. 00467 if (this->end_event_loop_ != 0) 00468 break; 00469 00470 // <end_event_loop> is not set. Ready to do <handle_events>. 00471 result = this->handle_events (); 00472 00473 if (eh != 0 && (*eh) (this)) 00474 continue; 00475 00476 if (result == -1) 00477 break; 00478 } 00479 00480 // Leaving the event loop. Decrement the thread count. 00481 00482 { 00483 // Obtain the lock in the MT environments. 00484 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1)); 00485 00486 // Decrement the thread count. 00487 this->event_loop_thread_count_ --; 00488 00489 if (this->event_loop_thread_count_ > 0 00490 && this->end_event_loop_ != 0) 00491 this->proactor_post_wakeup_completions (1); 00492 } 00493 00494 return result; 00495 } |
|
This method adds the to the I/O completion port. This function is a no-op function for Unix systems and returns 0; Definition at line 637 of file Proactor.cpp. References implementation(), and ACE_Proactor_Impl::register_handle().
00639 { 00640 return this->implementation ()->register_handle (handle, 00641 completion_key); 00642 } |
|
Resets the <ACE_Proactor::end_event_loop_> static so that the method can be restarted. Definition at line 33 of file Proactor.inl. References ACE_TRACE, instance(), and proactor_reset_event_loop().
00034 { 00035 ACE_TRACE ("ACE_Proactor::reset_event_loop"); 00036 ACE_Proactor * const p = ACE_Proactor::instance (); 00037 00038 if (p == 0) 00039 return -1; 00040 00041 return p->proactor_reset_event_loop (); 00042 } |
|
Run the event loop until the <ACE_Proactor::handle_events> method returns -1, the method is invoked, or the expires, in which case 0 is returned. Definition at line 20 of file Proactor.inl. References ACE_TRACE, check_reconfiguration(), instance(), and proactor_run_event_loop().
00021 { 00022 ACE_TRACE ("ACE_Proactor::run_event_loop (tv)"); 00023 ACE_Proactor * const p = ACE_Proactor::instance (); 00024 00025 if (p == 0) 00026 return -1; 00027 00028 return p->proactor_run_event_loop 00029 (tv, ACE_Proactor::check_reconfiguration); 00030 } |
|
Run the event loop until the <ACE_Proactor::handle_events> method returns -1 or the method is invoked. Definition at line 8 of file Proactor.inl. References ACE_TRACE, check_reconfiguration(), instance(), and proactor_run_event_loop().
00009 { 00010 ACE_TRACE ("ACE_Proactor::run_event_loop"); 00011 ACE_Proactor * const p = ACE_Proactor::instance (); 00012 00013 if (p == 0) 00014 return -1; 00015 00016 return p->proactor_run_event_loop (ACE_Proactor::check_reconfiguration); 00017 } |
|
Definition at line 656 of file Proactor.cpp. References schedule_timer().
00659 { 00660 return this->schedule_timer (handler, 00661 act, 00662 interval, 00663 interval); 00664 } |
|
This combines the above two methods into one. Mostly for backward compatibility. Definition at line 667 of file Proactor.cpp. References ACE_GUARD_RETURN, ACE_SYNCH_RECURSIVE_MUTEX, ACE_Event::signal(), ACE_Proactor_Timer_Handler::timer_event_, and timer_handler_.
00671 { 00672 // absolute time. 00673 ACE_Time_Value absolute_time = 00674 this->timer_queue_->gettimeofday () + time; 00675 00676 // Only one guy goes in here at a time 00677 ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, 00678 ace_mon, 00679 this->timer_queue_->mutex (), 00680 -1)); 00681 00682 // Schedule the timer 00683 long result = this->timer_queue_->schedule (&handler, 00684 act, 00685 absolute_time, 00686 interval); 00687 if (result != -1) 00688 { 00689 // no failures: check to see if we are the earliest time 00690 if (this->timer_queue_->earliest_time () == absolute_time) 00691 00692 // wake up the timer thread 00693 if (this->timer_handler_->timer_event_.signal () == -1) 00694 { 00695 // Cancel timer 00696 this->timer_queue_->cancel (result); 00697 result = -1; 00698 } 00699 } 00700 return result; 00701 } |
|
Schedule a that will expire after . If it expires then is passed in as the value to the 's callback method. This method returns a . This can be used to cancel a timer before it expires. The cancellation ensures that are unique up to values of greater than 2 billion timers. As long as timers don't stay around longer than this there should be no problems with accidentally deleting the wrong timer. Returns -1 on failure (which is guaranteed never to be a valid ). Definition at line 645 of file Proactor.cpp. Referenced by schedule_repeating_timer().
00648 { 00649 return this->schedule_timer (handler, 00650 act, 00651 time, 00652 ACE_Time_Value::zero); 00653 } |
|
Set timer queue.
Definition at line 768 of file Proactor.cpp. References ACE_NEW, and TIMER_HEAP.
00769 { 00770 // Cleanup old timer queue. 00771 if (this->delete_timer_queue_) 00772 { 00773 delete this->timer_queue_; 00774 this->delete_timer_queue_ = 0; 00775 } 00776 00777 // New timer queue. 00778 if (tq == 0) 00779 { 00780 ACE_NEW (this->timer_queue_, 00781 TIMER_HEAP); 00782 this->delete_timer_queue_ = 1; 00783 } 00784 else 00785 { 00786 this->timer_queue_ = tq; 00787 this->delete_timer_queue_ = 0; 00788 } 00789 00790 // Set the proactor in the timer queue's functor 00791 this->timer_queue_->upcall_functor ().proactor (*this); 00792 } |
|
Get timer queue.
Definition at line 762 of file Proactor.cpp. Referenced by ACE_Proactor(), and ACE_Proactor_Timer_Handler::svc().
00763 { 00764 return this->timer_queue_; 00765 } |
|
Add wakeup dispatch threads (reinit).
Definition at line 738 of file Proactor.cpp.
00739 {
00740 return 0;
00741 }
|
|
Timer handler runs a thread and manages the timers, on behalf of the Proactor. Definition at line 171 of file Proactor.h. |
|
Flag used to indicate whether we are responsible for cleaning up the implementation instance. Definition at line 602 of file Proactor.h. |
|
Must delete the if non-0. Controls whether the Proactor is deleted when we shut down (we can only delete it safely if we created it!) Definition at line 48 of file Proactor.cpp. Referenced by close_singleton(), and instance(). |
|
Flag on whether to delete the timer queue.
Definition at line 620 of file Proactor.h. |
|
Terminate the proactor event loop.
Definition at line 623 of file Proactor.h. Referenced by proactor_end_event_loop(), proactor_event_loop_done(), proactor_reset_event_loop(), and proactor_run_event_loop(). |
|
Number of threads in the event loop.
Definition at line 626 of file Proactor.h. Referenced by proactor_end_event_loop(), and proactor_run_event_loop(). |
|
Delegation/implementation class that all methods will be forwarded to. Definition at line 598 of file Proactor.h. |
|
Mutex to protect work with lists.
Definition at line 629 of file Proactor.h. |
|
Pointer to a process-wide .
Definition at line 44 of file Proactor.cpp. Referenced by close_singleton(), and instance(). |
|
This will manage the thread in the Timer_Handler.
Definition at line 614 of file Proactor.h. |
|
Handles timeout events.
Definition at line 611 of file Proactor.h. Referenced by ACE_Proactor(), close(), and schedule_timer(). |
|
Timer Queue.
Definition at line 617 of file Proactor.h. |