Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_Proactor Class Reference

A manager for asynchronous event demultiplexing. More...

#include <Proactor.h>

Collaboration diagram for ACE_Proactor:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Timer_Queue_T<
ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall,
ACE_SYNCH_RECURSIVE_MUTEX > 
TIMER_QUEUE
 Public type. More...

typedef int(* PROACTOR_EVENT_HOOK )(ACE_Proactor *)

Public Methods

 ACE_Proactor (ACE_Proactor_Impl *implementation=0, int delete_implementation=0, TIMER_QUEUE *tq=0)
virtual ~ACE_Proactor (void)
 Virtual destruction. More...

virtual int close (void)
 Close the associated ACE_Proactor_Impl implementation object. More...

virtual int proactor_run_event_loop (PROACTOR_EVENT_HOOK=0)
virtual int proactor_run_event_loop (ACE_Time_Value &tv, PROACTOR_EVENT_HOOK=0)
virtual int proactor_end_event_loop (void)
virtual int proactor_event_loop_done (void)
 Report if the ACE_Proactor event loop is finished. More...

virtual int proactor_reset_event_loop (void)
 Resets the <ACE_Proactor::end_event_loop_> static so that the <run_event_loop> method can be restarted. More...

virtual int register_handle (ACE_HANDLE handle, const void *completion_key)
 This method adds the <handle> to the I/O completion port. This function is a no-op function for Unix systems and returns 0;. More...

virtual long schedule_timer (ACE_Handler &handler, const void *act, const ACE_Time_Value &time)
virtual long schedule_repeating_timer (ACE_Handler &handler, const void *act, const ACE_Time_Value &interval)
virtual long schedule_timer (ACE_Handler &handler, const void *act, const ACE_Time_Value &time, const ACE_Time_Value &interval)
 This combines the above two methods into one. Mostly for backward compatibility. More...

virtual int cancel_timer (ACE_Handler &handler, int dont_call_handle_close=1)
 Cancel all timers associated with this <handler>. Returns number of timers cancelled. More...

virtual int cancel_timer (long timer_id, const void **act=0, int dont_call_handle_close=1)
virtual int handle_events (ACE_Time_Value &wait_time)
virtual int handle_events (void)
int wake_up_dispatch_threads (void)
 Add wakeup dispatch threads (reinit). More...

int close_dispatch_threads (int wait)
 Close all dispatch threads. More...

size_t number_of_threads (void) const
 Get number of thread used as a parameter to CreatIoCompletionPort. More...

void number_of_threads (size_t threads)
 Set number of thread used as a parameter to CreatIoCompletionPort. More...

TIMER_QUEUEtimer_queue (void) const
 Get timer queue. More...

void timer_queue (TIMER_QUEUE *timer_queue)
 Set timer queue. More...

virtual ACE_HANDLE get_handle (void) const
virtual ACE_Proactor_Implimplementation (void) const
 Get the implementation class. More...

virtual ACE_Asynch_Read_Stream_Implcreate_asynch_read_stream (void)
 Create the correct implementation class for doing Asynch_Read_Stream. More...

virtual ACE_Asynch_Write_Stream_Implcreate_asynch_write_stream (void)
 Create the correct implementation class for doing Asynch_Write_Stream. More...

virtual ACE_Asynch_Read_File_Implcreate_asynch_read_file (void)
 Create the correct implementation class for doing Asynch_Read_File. More...

virtual ACE_Asynch_Write_File_Implcreate_asynch_write_file (void)
 Create the correct implementation class for doing Asynch_Write_File. More...

virtual ACE_Asynch_Accept_Implcreate_asynch_accept (void)
 Create the correct implementation class for doing Asynch_Accept. More...

virtual ACE_Asynch_Connect_Implcreate_asynch_connect (void)
 Create the correct implementation class for doing Asynch_Connect. More...

virtual ACE_Asynch_Transmit_File_Implcreate_asynch_transmit_file (void)
 Create the correct implementation class for doing Asynch_Transmit_File. More...

virtual ACE_Asynch_Read_Dgram_Implcreate_asynch_read_dgram (void)
 Create the correct implementation class for doing Asynch_Read_Dgram. More...

virtual ACE_Asynch_Write_Dgram_Implcreate_asynch_write_dgram (void)
 Create the correct implementation class for doing Asynch_Write_Dgram. More...

virtual ACE_Asynch_Read_Stream_Result_Implcreate_asynch_read_stream_result (ACE_Handler &handler, 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)
 Create the correct implementation class for ACE_Asynch_Read_Stream::Result class. More...

virtual ACE_Asynch_Write_Stream_Result_Implcreate_asynch_write_stream_result (ACE_Handler &handler, 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)
 Create the correct implementation class for ACE_Asynch_Write_Stream::Result. More...

virtual ACE_Asynch_Read_File_Result_Implcreate_asynch_read_file_result (ACE_Handler &handler, 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)
 Create the correct implementation class for ACE_Asynch_Read_File::Result. More...

virtual ACE_Asynch_Write_File_Result_Implcreate_asynch_write_file_result (ACE_Handler &handler, 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)
 Create the correct implementation class for ACE_Asynch_Write_File::Result. More...

virtual ACE_Asynch_Read_Dgram_Result_Implcreate_asynch_read_dgram_result (ACE_Handler &handler, 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)
 Create the correct implementation class for ACE_Asynch_Read_Dgram::Result. More...

virtual ACE_Asynch_Write_Dgram_Result_Implcreate_asynch_write_dgram_result (ACE_Handler &handler, 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)
 Create the correct implementation class for ACE_Asynch_Write_Dgram::Result. More...

virtual ACE_Asynch_Accept_Result_Implcreate_asynch_accept_result (ACE_Handler &handler, 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. More...

virtual ACE_Asynch_Connect_Result_Implcreate_asynch_connect_result (ACE_Handler &handler, 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. More...

virtual ACE_Asynch_Transmit_File_Result_Implcreate_asynch_transmit_file_result (ACE_Handler &handler, 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)
 Create the correct implementation class for ACE_Asynch_Transmit_File::Result. More...

virtual ACE_Asynch_Result_Implcreate_asynch_timer (ACE_Handler &handler, const void *act, const ACE_Time_Value &tv, ACE_HANDLE event=ACE_INVALID_HANDLE, int priority=0, int signal_number=ACE_SIGRTMIN)

Static Public Methods

ACE_Proactor * instance (size_t threads=0)
 Get pointer to a process-wide <ACE_Proactor>. <threads> should be part of another method. More...

ACE_Proactor * instance (ACE_Proactor *proactor, int delete_proactor=0)
 Set pointer to a process-wide <ACE_Proactor> and return existing pointer. More...

void close_singleton (void)
 Delete the dynamically allocated Singleton. More...

void cleanup (void *instance, void *arg)
 Cleanup method, used by the <ACE_Object_Manager> to destroy the singleton. More...

const ACE_TCHARdll_name (void)
 Name of dll in which the singleton instance lives. More...

const ACE_TCHARname (void)
 Name of component--ACE_Proactor in this case. More...

int run_event_loop (void)
 Run the event loop until the <ACE_Proactor::handle_events> method returns -1 or the <end_event_loop> method is invoked. More...

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. More...


Protected Methods

virtual int proactor_post_wakeup_completions (int how_many)
virtual void implementation (ACE_Proactor_Impl *implementation)
 Set the implementation class. More...


Static Protected Methods

int post_wakeup_completions (int how_many)

Protected Attributes

ACE_Proactor_Implimplementation_
 Delegation/implementation class that all methods will be forwarded to. More...

int delete_implementation_
 Flag used to indicate whether we are responsible for cleaning up the implementation instance. More...

ACE_Proactor_Timer_Handlertimer_handler_
 Handles timeout events. More...

ACE_Thread_Manager thr_mgr_
 This will manage the thread in the Timer_Handler. More...

TIMER_QUEUEtimer_queue_
 Timer Queue. More...

int delete_timer_queue_
 Flag on whether to delete the timer queue. More...

sig_atomic_t end_event_loop_
 Terminate the proactor event loop. More...

sig_atomic_t event_loop_thread_count_
 Number of threads in the event loop. More...

ACE_SYNCH_MUTEX mutex_
 Mutex to protect work with lists. More...


Static Protected Attributes

ACE_Proactor * proactor_ = 0
 Pointer to a process-wide <ACE_Proactor>. More...

int delete_proactor_ = 0
 Must delete the <proactor_> if non-0. More...


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 Methods

 ACE_Proactor (const ACE_Proactor &)
 Deny access since member-wise won't work... More...

ACE_Proactor & operator= (const ACE_Proactor &)

Friends

class ACE_Proactor_Timer_Handler
 Timer handler runs a thread and manages the timers, on behalf of the Proactor. More...


Detailed Description

A manager for asynchronous event demultiplexing.

See the Proactor pattern description at http://www.cs.wustl.edu/~schmidt/proactor.ps.gz for more details.

Definition at line 103 of file Proactor.h.


Member Typedef Documentation

typedef int(* ACE_Proactor::PROACTOR_EVENT_HOOK)(ACE_Proactor *)
 

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 235 of file Proactor.h.

typedef ACE_Timer_Heap_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Proactor::TIMER_HEAP [private]
 

Definition at line 122 of file Proactor.h.

typedef ACE_Timer_Heap_Iterator_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Proactor::TIMER_HEAP_ITERATOR [private]
 

Definition at line 126 of file Proactor.h.

typedef ACE_Timer_List_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Proactor::TIMER_LIST [private]
 

Definition at line 114 of file Proactor.h.

typedef ACE_Timer_List_Iterator_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Proactor::TIMER_LIST_ITERATOR [private]
 

Definition at line 118 of file Proactor.h.

typedef ACE_Timer_Queue_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Proactor::TIMER_QUEUE
 

Public type.

Definition at line 147 of file Proactor.h.

typedef ACE_Timer_Queue_Iterator_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Proactor::TIMER_QUEUE_ITERATOR [private]
 

Definition at line 110 of file Proactor.h.

typedef ACE_Timer_Wheel_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Proactor::TIMER_WHEEL [private]
 

Definition at line 130 of file Proactor.h.

typedef ACE_Timer_Wheel_Iterator_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Proactor::TIMER_WHEEL_ITERATOR [private]
 

Definition at line 134 of file Proactor.h.


Constructor & Destructor Documentation

ACE_Proactor::ACE_Proactor ACE_Proactor_Impl   implementation = 0,
int    delete_implementation = 0,
TIMER_QUEUE   tq = 0
 

Constructor. If <implementation> is 0, the correct implementation object will be created. <delete_implementation> flag determines whether the implementation object should be deleted by the Proactor or not. If <tq> is 0, a new TIMER_QUEUE is created.

Definition at line 245 of file Proactor.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ACE_NEW, ACE_Task_Base::activate, delete_implementation_, implementation, LM_ERROR, timer_handler_, and timer_queue.

00248   : implementation_ (0),
00249     delete_implementation_ (delete_implementation),
00250     timer_handler_ (0),
00251     timer_queue_ (0),
00252     delete_timer_queue_ (0),
00253     end_event_loop_ (0),
00254     event_loop_thread_count_ (0)
00255 {
00256   this->implementation (implementation);
00257 
00258   if (this->implementation () == 0)
00259     {
00260 #if defined (ACE_HAS_AIO_CALLS)
00261       // POSIX Proactor.
00262 #  if defined (ACE_POSIX_AIOCB_PROACTOR)
00263       ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor);
00264 #  elif defined (ACE_POSIX_SIG_PROACTOR)
00265       ACE_NEW (implementation, ACE_POSIX_SIG_Proactor);
00266 #  else /* Default is to use the SIG one */
00267 #    if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
00268       ACE_NEW (implementation, ACE_POSIX_SIG_Proactor);
00269 #    else
00270       ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor);
00271 #    endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
00272 #  endif /* ACE_POSIX_AIOCB_PROACTOR */
00273 #elif (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
00274       // WIN_Proactor.
00275       ACE_NEW (implementation,
00276                ACE_WIN32_Proactor);
00277 #endif /* ACE_HAS_AIO_CALLS */
00278       this->implementation (implementation);
00279       this->delete_implementation_ = 1;
00280     }
00281 
00282   // Set the timer queue.
00283   this->timer_queue (tq);
00284 
00285   // Create the timer handler
00286   ACE_NEW (this->timer_handler_,
00287            ACE_Proactor_Timer_Handler (*this));
00288 
00289   // Activate <timer_handler>.
00290   if (this->timer_handler_->activate (THR_NEW_LWP) == -1)
00291     ACE_ERROR ((LM_ERROR,
00292                 ACE_LIB_TEXT ("%N:%l:(%P | %t):%p\n"),
00293                 ACE_LIB_TEXT ("Task::activate:could not create thread\n")));
00294 }

ACE_Proactor::~ACE_Proactor void    [virtual]
 

Virtual destruction.

Definition at line 296 of file Proactor.cpp.

References close.

00297 {
00298   this->close ();
00299 }

ACE_Proactor::ACE_Proactor const ACE_Proactor &    [private]
 

Deny access since member-wise won't work...


Member Function Documentation

int ACE_Proactor::cancel_timer long    timer_id,
const void **    act = 0,
int    dont_call_handle_close = 1
[virtual]
 

Cancel the single <ACE_Handler> that matches the <timer_id> value (which was returned from the <schedule> method). If <act> is non-NULL then it will be set to point to the ``magic cookie'' argument passed in when the <Handler> was registered. This makes it possible to free up the memory and avoid memory leaks. Returns 1 if cancellation succeeded and 0 if the <timer_id> wasn't found.

Definition at line 645 of file Proactor.cpp.

References ACE_Timer_Queue_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX >::cancel, and timer_queue_.

00648 {
00649   // No need to singal timer event here. Even if the cancel timer was
00650   // the earliest, we will have an extra wakeup.
00651   return this->timer_queue_->cancel (timer_id,
00652                                      arg,
00653                                      dont_call_handle_close);
00654 }

int ACE_Proactor::cancel_timer ACE_Handler   handler,
int    dont_call_handle_close = 1
[virtual]
 

Cancel all timers associated with this <handler>. Returns number of timers cancelled.

Definition at line 657 of file Proactor.cpp.

References ACE_Timer_Queue_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX >::cancel, and timer_queue_.

00659 {
00660   // No need to signal timer event here. Even if the cancel timer was
00661   // the earliest, we will have an extra wakeup.
00662   return this->timer_queue_->cancel (&handler,
00663                                      dont_call_handle_close);
00664 }

int ACE_Proactor::check_reconfiguration ACE_Proactor *    [static]
 

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 373 of file Proactor.cpp.

References ACE_Service_Config::reconfig_occurred, and ACE_Service_Config::reconfigure.

Referenced by run_event_loop.

00374 {
00375 #if !defined (ACE_HAS_WINCE)  &&  !defined (ACE_LACKS_ACE_SVCCONF)
00376   if (ACE_Service_Config::reconfig_occurred ())
00377     {
00378       ACE_Service_Config::reconfigure ();
00379       return 1;
00380     }
00381 #endif /* ! ACE_HAS_WINCE || ! ACE_LACKS_ACE_SVCCONF */
00382   return 0;
00383 }

void ACE_Proactor::cleanup void *    instance,
void *    arg
[static]
 

Cleanup method, used by the <ACE_Object_Manager> to destroy the singleton.

int ACE_Proactor::close void    [virtual]
 

Close the associated ACE_Proactor_Impl implementation object.

If

  • delete_implementation was specified to the open() method, the implementation object is also deleted.

Definition at line 543 of file Proactor.cpp.

References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_Proactor_Impl::close, delete_implementation_, delete_timer_queue_, implementation, implementation_, LM_ERROR, timer_handler_, and timer_queue_.

Referenced by ~ACE_Proactor.

00544 {
00545   // Close the implementation.
00546   if (this->implementation ()->close () == -1)
00547     ACE_ERROR_RETURN ((LM_ERROR,
00548                        ACE_LIB_TEXT ("%N:%l:(%P | %t):%p\n"),
00549                        ACE_LIB_TEXT ("ACE_Proactor::close:implementation couldnt be closed")),
00550                       -1);
00551 
00552   // Delete the implementation.
00553   if (this->delete_implementation_)
00554     {
00555       delete this->implementation ();
00556       this->implementation_ = 0;
00557     }
00558 
00559   // Delete the timer handler.
00560   if (this->timer_handler_)
00561     {
00562       delete this->timer_handler_;
00563       this->timer_handler_ = 0;
00564     }
00565 
00566   // Delete the timer queue.
00567   if (this->delete_timer_queue_)
00568     {
00569       delete this->timer_queue_;
00570       this->timer_queue_ = 0;
00571       this->delete_timer_queue_ = 0;
00572     }
00573 
00574   return 0;
00575 }

int ACE_Proactor::close_dispatch_threads int    wait
 

Close all dispatch threads.

Definition at line 685 of file Proactor.cpp.

00686 {
00687   return 0;
00688 }

void ACE_Proactor::close_singleton void    [static]
 

Delete the dynamically allocated Singleton.

Definition at line 344 of file Proactor.cpp.

References ACE_GUARD, ACE_MT, ACE_TRACE, delete_proactor_, ACE_Static_Object_Lock::instance, and proactor_.

00345 {
00346   ACE_TRACE ("ACE_Proactor::close_singleton");
00347 
00348   ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
00349                      *ACE_Static_Object_Lock::instance ()));
00350 
00351   if (ACE_Proactor::delete_proactor_)
00352     {
00353 
00354       delete ACE_Proactor::proactor_;
00355       ACE_Proactor::proactor_ = 0;
00356       ACE_Proactor::delete_proactor_ = 0;
00357     }
00358 }

ACE_Asynch_Accept_Impl * ACE_Proactor::create_asynch_accept void    [virtual]
 

Create the correct implementation class for doing Asynch_Accept.

Definition at line 785 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_accept, and implementation.

Referenced by ACE_Asynch_Accept::open.

00786 {
00787   return this->implementation ()->create_asynch_accept ();
00788 }

ACE_Asynch_Accept_Result_Impl * ACE_Proactor::create_asynch_accept_result ACE_Handler   handler,
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
[virtual]
 

Create the correct implementation class for ACE_Asynch_Accept::Result.

Definition at line 941 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_accept_result, and implementation.

00951 {
00952   return this->implementation ()->create_asynch_accept_result (handler,
00953                                                                listen_handle,
00954                                                                accept_handle,
00955                                                                message_block,
00956                                                                bytes_to_read,
00957                                                                act,
00958                                                                event,
00959                                                                priority,
00960                                                                signal_number);
00961 }

ACE_Asynch_Connect_Impl * ACE_Proactor::create_asynch_connect void    [virtual]
 

Create the correct implementation class for doing Asynch_Connect.

Definition at line 791 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_connect, and implementation.

Referenced by ACE_Asynch_Connect::open.

00792 {
00793   return this->implementation ()->create_asynch_connect ();
00794 }

ACE_Asynch_Connect_Result_Impl * ACE_Proactor::create_asynch_connect_result ACE_Handler   handler,
ACE_HANDLE    connect_handle,
const void *    act,
ACE_HANDLE    event = ACE_INVALID_HANDLE,
int    priority = 0,
int    signal_number = ACE_SIGRTMIN
[virtual]
 

Create the correct implementation class for ACE_Asynch_Connect::Result.

Definition at line 964 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_connect_result, and implementation.

00971 {
00972   return this->implementation ()->create_asynch_connect_result (handler,
00973                                                                 connect_handle,
00974                                                                 act,
00975                                                                 event,
00976                                                                 priority,
00977                                                                 signal_number);
00978 }

ACE_Asynch_Read_Dgram_Impl * ACE_Proactor::create_asynch_read_dgram void    [virtual]
 

Create the correct implementation class for doing Asynch_Read_Dgram.

Definition at line 761 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_read_dgram, and implementation.

Referenced by ACE_Asynch_Read_Dgram::open.

00762 {
00763   return this->implementation ()->create_asynch_read_dgram ();
00764 }

ACE_Asynch_Read_Dgram_Result_Impl * ACE_Proactor::create_asynch_read_dgram_result ACE_Handler   handler,
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
[virtual]
 

Create the correct implementation class for ACE_Asynch_Read_Dgram::Result.

Definition at line 895 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_read_dgram_result, and implementation.

00905 {
00906   return this->implementation()->create_asynch_read_dgram_result (handler,
00907                                                                   handle,
00908                                                                   message_block,
00909                                                                   bytes_to_read,
00910                                                                   flags,
00911                                                                   protocol_family,
00912                                                                   act,
00913                                                                   event,
00914                                                                   priority,
00915                                                                   signal_number);
00916 }

ACE_Asynch_Read_File_Impl * ACE_Proactor::create_asynch_read_file void    [virtual]
 

Create the correct implementation class for doing Asynch_Read_File.

Definition at line 773 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_read_file, and implementation.

Referenced by ACE_Asynch_Read_File::open.

00774 {
00775   return this->implementation ()->create_asynch_read_file ();
00776 }

ACE_Asynch_Read_File_Result_Impl * ACE_Proactor::create_asynch_read_file_result ACE_Handler   handler,
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
[virtual]
 

Create the correct implementation class for ACE_Asynch_Read_File::Result.

Definition at line 845 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_read_file_result, and implementation.

00856 {
00857   return this->implementation ()->create_asynch_read_file_result (handler,
00858                                                                   handle,
00859                                                                   message_block,
00860                                                                   bytes_to_read,
00861                                                                   act,
00862                                                                   offset,
00863                                                                   offset_high,
00864                                                                   event,
00865                                                                   priority,
00866                                                                   signal_number);
00867 }

ACE_Asynch_Read_Stream_Impl * ACE_Proactor::create_asynch_read_stream void    [virtual]
 

Create the correct implementation class for doing Asynch_Read_Stream.

Definition at line 749 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_read_stream, and implementation.

Referenced by ACE_Asynch_Read_Stream::open.

00750 {
00751   return this->implementation ()->create_asynch_read_stream ();
00752 }

ACE_Asynch_Read_Stream_Result_Impl * ACE_Proactor::create_asynch_read_stream_result ACE_Handler   handler,
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
[virtual]
 

Create the correct implementation class for ACE_Asynch_Read_Stream::Result class.

Definition at line 803 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_read_stream_result, and implementation.

00811 {
00812   return this->implementation ()->create_asynch_read_stream_result (handler,
00813                                                                     handle,
00814                                                                     message_block,
00815                                                                     bytes_to_read,
00816                                                                     act,
00817                                                                     event,
00818                                                                     priority,
00819                                                                     signal_number);
00820 }

ACE_Asynch_Result_Impl * ACE_Proactor::create_asynch_timer ACE_Handler   handler,
const void *    act,
const ACE_Time_Value   tv,
ACE_HANDLE    event = ACE_INVALID_HANDLE,
int    priority = 0,
int    signal_number = ACE_SIGRTMIN
[virtual]
 

Create a timer result object which can be used with the Timer mechanism of the Proactor. If <signal_number> is -1, <POSIX_SIG_Proactor> 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 1012 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_timer, and implementation.

Referenced by ACE_Proactor_Handle_Timeout_Upcall::timeout.

01018 {
01019   return this->implementation ()->create_asynch_timer (handler,
01020                                                        act,
01021                                                        tv,
01022                                                        event,
01023                                                        priority,
01024                                                        signal_number);
01025 }

ACE_Asynch_Transmit_File_Impl * ACE_Proactor::create_asynch_transmit_file void    [virtual]
 

Create the correct implementation class for doing Asynch_Transmit_File.

Definition at line 797 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_transmit_file, and implementation.

Referenced by ACE_Asynch_Transmit_File::open.

00798 {
00799   return this->implementation ()->create_asynch_transmit_file ();
00800 }

ACE_Asynch_Transmit_File_Result_Impl * ACE_Proactor::create_asynch_transmit_file_result ACE_Handler   handler,
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
[virtual]
 

Create the correct implementation class for ACE_Asynch_Transmit_File::Result.

Definition at line 981 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_transmit_file_result, and implementation.

00995 {
00996   return this->implementation ()->create_asynch_transmit_file_result (handler,
00997                                                                       socket,
00998                                                                       file,
00999                                                                       header_and_trailer,
01000                                                                       bytes_to_write,
01001                                                                       offset,
01002                                                                       offset_high,
01003                                                                       bytes_per_send,
01004                                                                       flags,
01005                                                                       act,
01006                                                                       event,
01007                                                                       priority,
01008                                                                       signal_number);
01009 }

ACE_Asynch_Write_Dgram_Impl * ACE_Proactor::create_asynch_write_dgram void    [virtual]
 

Create the correct implementation class for doing Asynch_Write_Dgram.

Definition at line 767 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_write_dgram, and implementation.

Referenced by ACE_Asynch_Write_Dgram::open.

00768 {
00769   return this->implementation ()->create_asynch_write_dgram ();
00770 }

ACE_Asynch_Write_Dgram_Result_Impl * ACE_Proactor::create_asynch_write_dgram_result ACE_Handler   handler,
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
[virtual]
 

Create the correct implementation class for ACE_Asynch_Write_Dgram::Result.

Definition at line 919 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_write_dgram_result, and implementation.

00928 {
00929   return this->implementation()->create_asynch_write_dgram_result (handler,
00930                                                                    handle,
00931                                                                    message_block,
00932                                                                    bytes_to_write,
00933                                                                    flags,
00934                                                                    act,
00935                                                                    event,
00936                                                                    priority,
00937                                                                    signal_number);
00938 }

ACE_Asynch_Write_File_Impl * ACE_Proactor::create_asynch_write_file void    [virtual]
 

Create the correct implementation class for doing Asynch_Write_File.

Definition at line 779 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_write_file, and implementation.

Referenced by ACE_Asynch_Write_File::open.

00780 {
00781   return this->implementation ()->create_asynch_write_file ();
00782 }

ACE_Asynch_Write_File_Result_Impl * ACE_Proactor::create_asynch_write_file_result ACE_Handler   handler,
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
[virtual]
 

Create the correct implementation class for ACE_Asynch_Write_File::Result.

Definition at line 870 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_write_file_result, and implementation.

00881 {
00882   return this->implementation ()->create_asynch_write_file_result (handler,
00883                                                                    handle,
00884                                                                    message_block,
00885                                                                    bytes_to_write,
00886                                                                    act,
00887                                                                    offset,
00888                                                                    offset_high,
00889                                                                    event,
00890                                                                    priority,
00891                                                                    signal_number);
00892 }

ACE_Asynch_Write_Stream_Impl * ACE_Proactor::create_asynch_write_stream void    [virtual]
 

Create the correct implementation class for doing Asynch_Write_Stream.

Definition at line 755 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_write_stream, and implementation.

Referenced by ACE_Asynch_Write_Stream::open.

00756 {
00757   return this->implementation ()->create_asynch_write_stream ();
00758 }

ACE_Asynch_Write_Stream_Result_Impl * ACE_Proactor::create_asynch_write_stream_result ACE_Handler   handler,
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
[virtual]
 

Create the correct implementation class for ACE_Asynch_Write_Stream::Result.

Definition at line 824 of file Proactor.cpp.

References ACE_Proactor_Impl::create_asynch_write_stream_result, and implementation.

00833 {
00834   return this->implementation ()->create_asynch_write_stream_result (handler,
00835                                                                      handle,
00836                                                                      message_block,
00837                                                                      bytes_to_write,
00838                                                                      act,
00839                                                                      event,
00840                                                                      priority,
00841                                                                      signal_number);
00842 }

const ACE_TCHAR * ACE_Proactor::dll_name void    [static]
 

Name of dll in which the singleton instance lives.

Definition at line 361 of file Proactor.cpp.

References ACE_LIB_TEXT.

00362 {
00363   return ACE_LIB_TEXT ("ACE");
00364 }

ACE_INLINE int ACE_Proactor::end_event_loop void    [static]
 

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 42 of file Proactor.i.

References ACE_TRACE, instance, and proactor_end_event_loop.

00043 {
00044   ACE_TRACE ("ACE_Proactor::end_event_loop");
00045   ACE_Proactor *p = ACE_Proactor::instance ();
00046 
00047   if (p == 0)
00048     return -1;
00049 
00050   return p->proactor_end_event_loop ();
00051 }

ACE_INLINE int ACE_Proactor::event_loop_done void    [static]
 

Report if the <ACE_Proactor::instance> event loop is finished.

Definition at line 54 of file Proactor.i.

References ACE_TRACE, instance, and proactor_event_loop_done.

00055 {
00056   ACE_TRACE ("ACE_Proactor::event_loop_done");
00057   ACE_Proactor *p = ACE_Proactor::instance ();
00058 
00059   if (p == 0)
00060     return -1;
00061 
00062   return p->proactor_event_loop_done ();
00063 }

ACE_HANDLE ACE_Proactor::get_handle void    const [virtual]
 

Get the event handle. It is a no-op in POSIX platforms and it returns ACE_INVALID_HANDLE.

Definition at line 736 of file Proactor.cpp.

References ACE_Proactor_Impl::get_handle, and implementation.

00737 {
00738   return this->implementation ()->get_handle ();
00739 }

int ACE_Proactor::handle_events void    [virtual]
 

Block indefinitely until at least one event is dispatched.

Returns:
Returns 1 when a completion is dispatched. On error, returns -1 and sets errno accordingly.

Definition at line 673 of file Proactor.cpp.

References ACE_Proactor_Impl::handle_events, and implementation.

Referenced by proactor_run_event_loop.

00674 {
00675   return this->implementation ()->handle_events ();
00676 }

int ACE_Proactor::handle_events ACE_Time_Value   wait_time [virtual]
 

Dispatch a single set of events, waiting up to a specified time limit if necessary.

Parameters:
wait_time  the time to wait for an event to occur. This is a relative time. On successful return, the time is updated to reflect the amount of time spent waiting for event(s) to occur.
Returns:
Returns 0 if no events occur before the wait_time expires. Returns 1 when a completion is dispatched. On error, returns -1 and sets errno accordingly.

Definition at line 667 of file Proactor.cpp.

References ACE_Proactor_Impl::handle_events, and implementation.

00668 {
00669   return implementation ()->handle_events (wait_time);
00670 }

void ACE_Proactor::implementation ACE_Proactor_Impl   implementation [protected, virtual]
 

Set the implementation class.

Definition at line 1034 of file Proactor.cpp.

References implementation_.

01035 {
01036   this->implementation_ = implementation;
01037 }

ACE_Proactor_Impl * ACE_Proactor::implementation void    const [virtual]
 

Get the implementation class.

Definition at line 742 of file Proactor.cpp.

References implementation_.

Referenced by ACE_Proactor, close, create_asynch_accept, create_asynch_accept_result, create_asynch_connect, create_asynch_connect_result, create_asynch_read_dgram, create_asynch_read_dgram_result, create_asynch_read_file, create_asynch_read_file_result, create_asynch_read_stream, create_asynch_read_stream_result, create_asynch_timer, create_asynch_transmit_file, create_asynch_transmit_file_result, create_asynch_write_dgram, create_asynch_write_dgram_result, create_asynch_write_file, create_asynch_write_file_result, create_asynch_write_stream, create_asynch_write_stream_result, get_handle, handle_events, number_of_threads, proactor_post_wakeup_completions, and register_handle.

00743 {
00744   return this->implementation_;
00745 }

ACE_Proactor * ACE_Proactor::instance ACE_Proactor *    proactor,
int    delete_proactor = 0
[static]
 

Set pointer to a process-wide <ACE_Proactor> and return existing pointer.

Definition at line 327 of file Proactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_REGISTER_FRAMEWORK_COMPONENT, ACE_TRACE, delete_proactor_, ACE_Static_Object_Lock::instance, and proactor_.

00328 {
00329   ACE_TRACE ("ACE_Proactor::instance");
00330 
00331   ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
00332                             *ACE_Static_Object_Lock::instance (), 0));
00333 
00334   ACE_Proactor *t = ACE_Proactor::proactor_;
00335 
00336   ACE_Proactor::delete_proactor_ = delete_proactor;
00337   ACE_Proactor::proactor_ = r;
00338   ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
00339 
00340   return t;
00341 }

ACE_Proactor * ACE_Proactor::instance size_t    threads = 0 [static]
 

Get pointer to a process-wide <ACE_Proactor>. <threads> should be part of another method.

Definition at line 302 of file Proactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_NEW_RETURN, ACE_REGISTER_FRAMEWORK_COMPONENT, ACE_TRACE, delete_proactor_, ACE_Static_Object_Lock::instance, 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.

00303 {
00304   ACE_TRACE ("ACE_Proactor::instance");
00305 
00306   if (ACE_Proactor::proactor_ == 0)
00307     {
00308       // Perform Double-Checked Locking Optimization.
00309       ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
00310                                 *ACE_Static_Object_Lock::instance (),
00311                                 0));
00312 
00313       if (ACE_Proactor::proactor_ == 0)
00314         {
00315           ACE_NEW_RETURN (ACE_Proactor::proactor_,
00316                           ACE_Proactor,
00317                           0);
00318 
00319           ACE_Proactor::delete_proactor_ = 1;
00320           ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
00321         }
00322     }
00323   return ACE_Proactor::proactor_;
00324 }

const ACE_TCHAR * ACE_Proactor::name void    [static]
 

Name of component--ACE_Proactor in this case.

Definition at line 367 of file Proactor.cpp.

References ACE_LIB_TEXT.

00368 {
00369   return ACE_LIB_TEXT ("ACE_Proactor");
00370 }

void ACE_Proactor::number_of_threads size_t    threads
 

Set number of thread used as a parameter to CreatIoCompletionPort.

Definition at line 697 of file Proactor.cpp.

References implementation, and ACE_Proactor_Impl::number_of_threads.

00698 {
00699   this->implementation ()->number_of_threads (threads);
00700 }

size_t ACE_Proactor::number_of_threads void    const
 

Get number of thread used as a parameter to CreatIoCompletionPort.

Definition at line 691 of file Proactor.cpp.

References implementation, and ACE_Proactor_Impl::number_of_threads.

00692 {
00693   return this->implementation ()->number_of_threads ();
00694 }

ACE_Proactor& ACE_Proactor::operator= const ACE_Proactor &    [private]
 

ACE_INLINE int ACE_Proactor::post_wakeup_completions int    how_many [static, protected]
 

Post <how_many> completions to the completion port so that all threads can wake up. This is used in conjunction with the <run_event_loop>.

Definition at line 66 of file Proactor.i.

References ACE_TRACE, instance, and proactor_post_wakeup_completions.

00067 {
00068   ACE_TRACE ("ACE_Proactor::post_wakeup_completions");
00069   ACE_Proactor *p = ACE_Proactor::instance ();
00070 
00071   if (p == 0)
00072     return -1;
00073 
00074   return p->proactor_post_wakeup_completions (how_many);
00075 }

int ACE_Proactor::proactor_end_event_loop void    [virtual]
 

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 507 of file Proactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, end_event_loop_, event_loop_thread_count_, mutex_, and proactor_post_wakeup_completions.

Referenced by end_event_loop.

00508 {
00509   ACE_TRACE ("ACE_Proactor::proactor_end_event_loop");
00510 
00511   int how_many = 0;
00512 
00513   {
00514     // Obtain the lock, set the end flag and post the wakeup
00515     // completions.
00516     ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
00517 
00518     // Set the end flag.
00519     this->end_event_loop_ = 1;
00520 
00521     // Number of completions to post.
00522     how_many = this->event_loop_thread_count_;
00523     if (how_many == 0)
00524       return 0;
00525   }
00526 
00527   // Post completions to all the threads so that they will all wake
00528   // up.
00529   return this->proactor_post_wakeup_completions (how_many);
00530 }

int ACE_Proactor::proactor_event_loop_done void    [virtual]
 

Report if the ACE_Proactor event loop is finished.

Definition at line 533 of file Proactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, end_event_loop_, and mutex_.

Referenced by event_loop_done.

00534 {
00535   ACE_TRACE ("ACE_Proactor::proactor_event_loop_done");
00536 
00537   ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
00538 
00539   return this->end_event_loop_ != 0 ? 1 : 0 ;
00540 }

int ACE_Proactor::proactor_post_wakeup_completions int    how_many [protected, virtual]
 

Post <how_many> completions to the completion port so that all threads can wake up. This is used in conjunction with the <proactor_run_event_loop>.

Definition at line 1028 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.

01029 {
01030   return this->implementation ()->post_wakeup_completions (how_many);
01031 }

int ACE_Proactor::proactor_reset_event_loop void    [virtual]
 

Resets the <ACE_Proactor::end_event_loop_> static so that the <run_event_loop> method can be restarted.

Definition at line 495 of file Proactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, end_event_loop_, and mutex_.

Referenced by reset_event_loop.

00496 {
00497   ACE_TRACE ("ACE_Proactor::proactor_reset_event_loop");
00498 
00499   // Obtain the lock in the MT environments.
00500   ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
00501 
00502   this->end_event_loop_ = 0;
00503   return 0;
00504 }

int ACE_Proactor::proactor_run_event_loop ACE_Time_Value   tv,
PROACTOR_EVENT_HOOK    = 0
[virtual]
 

Run the event loop until the <ACE_Proactor::handle_events> method returns -1, the <end_proactor_event_loop> method is invoked, or the <ACE_Time_Value> expires.

Definition at line 441 of file Proactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, end_event_loop_, event_loop_thread_count_, handle_events, mutex_, proactor_post_wakeup_completions, and ACE_Time_Value::zero.

00443 {
00444   ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
00445   int result = 0;
00446 
00447   {
00448     ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
00449 
00450     // Early check. It is ok to do this without lock, since we care just
00451     // whether it is zero or non-zero.
00452     if (this->end_event_loop_ != 0
00453        || tv == ACE_Time_Value::zero)
00454       return 0;
00455 
00456     // First time you are in. Increment the thread count.
00457     this->event_loop_thread_count_ ++;
00458   }
00459 
00460   // Run the event loop.
00461   for (;;)
00462     {
00463       // Check the end loop flag. It is ok to do this without lock,
00464       // since we care just whether it is zero or non-zero.
00465       if (this->end_event_loop_ != 0)
00466         break;
00467 
00468       // <end_event_loop> is not set. Ready to do <handle_events>.
00469       result = this->handle_events (tv);
00470 
00471       if (eh != 0 && (*eh) (this))
00472         continue;
00473 
00474       if (result == -1)
00475         break;
00476     }
00477 
00478   // Leaving the event loop. Decrement the thread count.
00479 
00480   {
00481     ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
00482 
00483     // Decrement the thread count.
00484     this->event_loop_thread_count_ --;
00485 
00486     if (this->event_loop_thread_count_ > 0
00487        && this->end_event_loop_ != 0)
00488        this->proactor_post_wakeup_completions (1);
00489   }
00490 
00491   return result;
00492 }

int ACE_Proactor::proactor_run_event_loop PROACTOR_EVENT_HOOK    = 0 [virtual]
 

Run the event loop until the <ACE_Proactor::handle_events> method returns -1 or the <end_proactor_event_loop> method is invoked.

Definition at line 386 of file Proactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_TRACE, end_event_loop_, event_loop_thread_count_, handle_events, mutex_, and proactor_post_wakeup_completions.

Referenced by run_event_loop.

00387 {
00388   ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
00389   int result = 0;
00390 
00391   {
00392     ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
00393 
00394     // Early check. It is ok to do this without lock, since we care just
00395     // whether it is zero or non-zero.
00396     if (this->end_event_loop_ != 0)
00397       return 0;
00398 
00399     // First time you are in. Increment the thread count.
00400     this->event_loop_thread_count_ ++;
00401   }
00402 
00403   // Run the event loop.
00404   for (;;)
00405     {
00406       // Check the end loop flag. It is ok to do this without lock,
00407       // since we care just whether it is zero or non-zero.
00408       if (this->end_event_loop_ != 0)
00409         break;
00410 
00411       // <end_event_loop> is not set. Ready to do <handle_events>.
00412       result = this->handle_events ();
00413 
00414       if (eh != 0 && (*eh) (this))
00415         continue;
00416 
00417       if (result == -1)
00418         break;
00419     }
00420 
00421   // Leaving the event loop. Decrement the thread count.
00422 
00423   {
00424     // Obtain the lock in the MT environments.
00425     ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
00426 
00427     // Decrement the thread count.
00428     this->event_loop_thread_count_ --;
00429 
00430     if (this->event_loop_thread_count_ > 0
00431        && this->end_event_loop_ != 0)
00432        this->proactor_post_wakeup_completions (1);
00433   }
00434 
00435   return result;
00436 }

int ACE_Proactor::register_handle ACE_HANDLE    handle,
const void *    completion_key
[virtual]
 

This method adds the <handle> to the I/O completion port. This function is a no-op function for Unix systems and returns 0;.

Definition at line 578 of file Proactor.cpp.

References implementation, and ACE_Proactor_Impl::register_handle.

00580 {
00581   return this->implementation ()->register_handle (handle,
00582                                                    completion_key);
00583 }

ACE_INLINE int ACE_Proactor::reset_event_loop void    [static]
 

Resets the <ACE_Proactor::end_event_loop_> static so that the <run_event_loop> method can be restarted.

Definition at line 30 of file Proactor.i.

References ACE_TRACE, instance, and proactor_reset_event_loop.

00031 {
00032   ACE_TRACE ("ACE_Proactor::reset_event_loop");
00033   ACE_Proactor *p = ACE_Proactor::instance ();
00034 
00035   if (p == 0)
00036     return -1;
00037 
00038   return p->proactor_reset_event_loop ();
00039 }

ACE_INLINE int ACE_Proactor::run_event_loop ACE_Time_Value   tv [static]
 

Run the event loop until the <ACE_Proactor::handle_events> method returns -1, the <end_event_loop> method is invoked, or the <ACE_Time_Value> expires.

Definition at line 17 of file Proactor.i.

References ACE_TRACE, check_reconfiguration, instance, and proactor_run_event_loop.

00018 {
00019   ACE_TRACE ("ACE_Proactor::run_event_loop (tv)");
00020   ACE_Proactor *p = ACE_Proactor::instance ();
00021 
00022   if (p == 0)
00023     return -1;
00024 
00025   return p->proactor_run_event_loop 
00026     (tv, ACE_Proactor::check_reconfiguration);
00027 }

ACE_INLINE int ACE_Proactor::run_event_loop void    [static]
 

Run the event loop until the <ACE_Proactor::handle_events> method returns -1 or the <end_event_loop> method is invoked.

Definition at line 5 of file Proactor.i.

References ACE_TRACE, check_reconfiguration, instance, and proactor_run_event_loop.

00006 {
00007   ACE_TRACE ("ACE_Proactor::run_event_loop");
00008   ACE_Proactor *p = ACE_Proactor::instance ();
00009 
00010   if (p == 0)
00011     return -1;
00012 
00013   return p->proactor_run_event_loop (ACE_Proactor::check_reconfiguration);
00014 }

long ACE_Proactor::schedule_repeating_timer ACE_Handler   handler,
const void *    act,
const ACE_Time_Value   interval
[virtual]
 

Definition at line 597 of file Proactor.cpp.

References schedule_timer.

00600 {
00601   return this->schedule_timer (handler,
00602                                act,
00603                                interval,
00604                                interval);
00605 }

long ACE_Proactor::schedule_timer ACE_Handler   handler,
const void *    act,
const ACE_Time_Value   time,
const ACE_Time_Value   interval
[virtual]
 

This combines the above two methods into one. Mostly for backward compatibility.

Definition at line 608 of file Proactor.cpp.

References ACE_GUARD_RETURN, ACE_MT, ACE_SYNCH_RECURSIVE_MUTEX, ACE_Timer_Queue_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX >::cancel, ACE_Timer_Queue_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX >::earliest_time, ACE_Timer_Queue_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX >::gettimeofday, ACE_Timer_Queue_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX >::schedule, ACE_Event::signal, ACE_Proactor_Timer_Handler::timer_event_, timer_handler_, and timer_queue_.

00612 {
00613   // absolute time.
00614   ACE_Time_Value absolute_time =
00615     this->timer_queue_->gettimeofday () + time;
00616 
00617   // Only one guy goes in here at a time
00618   ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX,
00619                     ace_mon,
00620                     this->timer_queue_->mutex (),
00621                     -1));
00622 
00623   // Schedule the timer
00624   long result = this->timer_queue_->schedule (&handler,
00625                                               act,
00626                                               absolute_time,
00627                                               interval);
00628   if (result != -1)
00629     {
00630       // no failures: check to see if we are the earliest time
00631       if (this->timer_queue_->earliest_time () == absolute_time)
00632 
00633         // wake up the timer thread
00634         if (this->timer_handler_->timer_event_.signal () == -1)
00635           {
00636             // Cancel timer
00637             this->timer_queue_->cancel (result);
00638             result = -1;
00639           }
00640     }
00641   return result;
00642 }

long ACE_Proactor::schedule_timer ACE_Handler   handler,
const void *    act,
const ACE_Time_Value   time
[virtual]
 

Schedule a <handler> that will expire after <time>. If it expires then <act> is passed in as the value to the <handler>'s <handle_timeout> callback method. This method returns a <timer_id>. This <timer_id> can be used to cancel a timer before it expires. The cancellation ensures that <timer_ids> 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 <timer_id>).

Definition at line 586 of file Proactor.cpp.

References ACE_Time_Value::zero.

Referenced by schedule_repeating_timer.

00589 {
00590   return this->schedule_timer (handler,
00591                                act,
00592                                time,
00593                                ACE_Time_Value::zero);
00594 }

void ACE_Proactor::timer_queue TIMER_QUEUE   timer_queue
 

Set timer queue.

Definition at line 709 of file Proactor.cpp.

References ACE_NEW, delete_timer_queue_, ACE_Proactor_Handle_Timeout_Upcall::proactor, timer_queue_, and ACE_Timer_Queue_T< ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall, ACE_SYNCH_RECURSIVE_MUTEX >::upcall_functor.

00710 {
00711   // Cleanup old timer queue.
00712   if (this->delete_timer_queue_)
00713     {
00714       delete this->timer_queue_;
00715       this->delete_timer_queue_ = 0;
00716     }
00717 
00718   // New timer queue.
00719   if (tq == 0)
00720     {
00721       ACE_NEW (this->timer_queue_,
00722                TIMER_HEAP);
00723       this->delete_timer_queue_ = 1;
00724     }
00725   else
00726     {
00727       this->timer_queue_ = tq;
00728       this->delete_timer_queue_ = 0;
00729     }
00730 
00731   // Set the proactor in the timer queue's functor
00732   this->timer_queue_->upcall_functor ().proactor (*this);
00733 }

ACE_Proactor::TIMER_QUEUE * ACE_Proactor::timer_queue void    const
 

Get timer queue.

Definition at line 703 of file Proactor.cpp.

References timer_queue_.

Referenced by ACE_Proactor, and ACE_Proactor_Timer_Handler::svc.

00704 {
00705   return this->timer_queue_;
00706 }

int ACE_Proactor::wake_up_dispatch_threads void   
 

Add wakeup dispatch threads (reinit).

Definition at line 679 of file Proactor.cpp.

00680 {
00681   return 0;
00682 }


Friends And Related Function Documentation

friend class ACE_Proactor_Timer_Handler [friend]
 

Timer handler runs a thread and manages the timers, on behalf of the Proactor.

Definition at line 140 of file Proactor.h.


Member Data Documentation

int ACE_Proactor::delete_implementation_ [protected]
 

Flag used to indicate whether we are responsible for cleaning up the implementation instance.

Definition at line 570 of file Proactor.h.

Referenced by ACE_Proactor, and close.

int ACE_Proactor::delete_proactor_ = 0 [static, protected]
 

Must delete the <proactor_> if non-0.

Definition at line 37 of file Proactor.cpp.

Referenced by close_singleton, and instance.

int ACE_Proactor::delete_timer_queue_ [protected]
 

Flag on whether to delete the timer queue.

Definition at line 588 of file Proactor.h.

Referenced by close, and timer_queue.

sig_atomic_t ACE_Proactor::end_event_loop_ [protected]
 

Terminate the proactor event loop.

Definition at line 591 of file Proactor.h.

Referenced by proactor_end_event_loop, proactor_event_loop_done, proactor_reset_event_loop, and proactor_run_event_loop.

sig_atomic_t ACE_Proactor::event_loop_thread_count_ [protected]
 

Number of threads in the event loop.

Definition at line 594 of file Proactor.h.

Referenced by proactor_end_event_loop, and proactor_run_event_loop.

ACE_Proactor_Impl* ACE_Proactor::implementation_ [protected]
 

Delegation/implementation class that all methods will be forwarded to.

Definition at line 566 of file Proactor.h.

Referenced by close, and implementation.

ACE_SYNCH_MUTEX ACE_Proactor::mutex_ [protected]
 

Mutex to protect work with lists.

Definition at line 597 of file Proactor.h.

Referenced by proactor_end_event_loop, proactor_event_loop_done, proactor_reset_event_loop, and proactor_run_event_loop.

ACE_Proactor * ACE_Proactor::proactor_ = 0 [static, protected]
 

Pointer to a process-wide <ACE_Proactor>.

Definition at line 33 of file Proactor.cpp.

Referenced by close_singleton, and instance.

ACE_Thread_Manager ACE_Proactor::thr_mgr_ [protected]
 

This will manage the thread in the Timer_Handler.

Definition at line 582 of file Proactor.h.

ACE_Proactor_Timer_Handler* ACE_Proactor::timer_handler_ [protected]
 

Handles timeout events.

Definition at line 579 of file Proactor.h.

Referenced by ACE_Proactor, close, and schedule_timer.

TIMER_QUEUE* ACE_Proactor::timer_queue_ [protected]
 

Timer Queue.

Definition at line 585 of file Proactor.h.

Referenced by cancel_timer, close, schedule_timer, and timer_queue.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:54:19 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002