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

Proactor.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Proactor.h
00006  *
00007  *  $Id: Proactor.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Irfan Pyarali <irfan@cs.wustl.edu>
00010  *  @author Tim Harrison <harrison@cs.wustl.edu>
00011  *  @author Alexander Babu Arulanthu <alex@cs.wustl.edu>
00012  *  @author Alexander Libman <alibman@ihug.com.au>
00013  */
00014 //=============================================================================
00015 
00016 #ifndef ACE_PROACTOR_H
00017 #define ACE_PROACTOR_H
00018 
00019 #include "ace/pre.h"
00020 
00021 #include "ace/config-all.h"
00022 #include "ace/ACE_export.h"
00023 #include "ace/OS.h"
00024 
00025 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00026 #pragma once
00027 #endif /* ACE_LACKS_PRAGMA_ONCE */
00028 
00029 #if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS)))
00030 // This only works on Win32 platforms and on Unix platforms supporting
00031 // POSIX aio calls.
00032 
00033 #  include "ace/Asynch_IO.h"
00034 #  include "ace/Asynch_IO_Impl.h"
00035 #  include "ace/Thread_Manager.h"
00036 #  include "ace/Timer_Queue.h"
00037 #  include "ace/Timer_List.h"
00038 #  include "ace/Timer_Heap.h"
00039 #  include "ace/Timer_Wheel.h"
00040 
00041 // Forward declarations.
00042 class ACE_Proactor_Impl;
00043 class ACE_Proactor_Timer_Handler;
00044 
00045 /**
00046  * @class ACE_Proactor_Handle_Timeout_Upcall
00047  *
00048  * @brief Functor for <ACE_Timer_Queue>.
00049  *
00050  * This class implements the functor required by the Timer
00051  * Queue to call <handle_timeout> on ACE_Handlers.
00052  */
00053 class ACE_Export ACE_Proactor_Handle_Timeout_Upcall
00054 {
00055 
00056   /// Type def for the timer queue.
00057   typedef ACE_Timer_Queue_T<ACE_Handler *,
00058                             ACE_Proactor_Handle_Timeout_Upcall,
00059                             ACE_SYNCH_RECURSIVE_MUTEX>
00060   TIMER_QUEUE;
00061 
00062   /// The main Proactor class has special permissions.
00063   friend class ACE_Proactor;
00064 
00065 public:
00066   /// Constructor.
00067   ACE_Proactor_Handle_Timeout_Upcall (void);
00068 
00069   /// This method is called when the timer expires.
00070   int timeout (TIMER_QUEUE &timer_queue,
00071                ACE_Handler *handler,
00072                const void *arg,
00073                const ACE_Time_Value &cur_time);
00074 
00075   /// This method is called when the timer is canceled.
00076   int cancellation (TIMER_QUEUE &timer_queue,
00077                     ACE_Handler *handler);
00078 
00079   /// This method is called when the timer queue is destroyed and the
00080   /// timer is still contained in it.
00081   int deletion (TIMER_QUEUE &timer_queue,
00082                 ACE_Handler *handler,
00083                 const void *arg);
00084 
00085 protected:
00086   /// Set the proactor. This will fail, if one is already set!
00087   int proactor (ACE_Proactor &proactor);
00088 
00089   /// Handle to the proactor. This is needed for posting a timer result
00090   /// to the Proactor's completion queue.
00091   ACE_Proactor *proactor_;
00092 };
00093 
00094 /**
00095  * @class ACE_Proactor
00096  *
00097  * @brief A manager for asynchronous event demultiplexing.
00098  *
00099  * See the Proactor pattern description at
00100  * http://www.cs.wustl.edu/~schmidt/proactor.ps.gz for more
00101  * details.
00102  */
00103 class ACE_Export ACE_Proactor
00104 {
00105   // = Here are the private typedefs that the <ACE_Proactor> uses.
00106 
00107   typedef ACE_Timer_Queue_Iterator_T<ACE_Handler *,
00108     ACE_Proactor_Handle_Timeout_Upcall,
00109     ACE_SYNCH_RECURSIVE_MUTEX>
00110   TIMER_QUEUE_ITERATOR;
00111   typedef ACE_Timer_List_T<ACE_Handler *,
00112     ACE_Proactor_Handle_Timeout_Upcall,
00113     ACE_SYNCH_RECURSIVE_MUTEX>
00114   TIMER_LIST;
00115   typedef ACE_Timer_List_Iterator_T<ACE_Handler *,
00116     ACE_Proactor_Handle_Timeout_Upcall,
00117     ACE_SYNCH_RECURSIVE_MUTEX>
00118   TIMER_LIST_ITERATOR;
00119   typedef ACE_Timer_Heap_T<ACE_Handler *,
00120     ACE_Proactor_Handle_Timeout_Upcall,
00121     ACE_SYNCH_RECURSIVE_MUTEX>
00122   TIMER_HEAP;
00123   typedef ACE_Timer_Heap_Iterator_T<ACE_Handler *,
00124     ACE_Proactor_Handle_Timeout_Upcall,
00125     ACE_SYNCH_RECURSIVE_MUTEX>
00126   TIMER_HEAP_ITERATOR;
00127   typedef ACE_Timer_Wheel_T<ACE_Handler *,
00128     ACE_Proactor_Handle_Timeout_Upcall,
00129     ACE_SYNCH_RECURSIVE_MUTEX>
00130   TIMER_WHEEL;
00131   typedef ACE_Timer_Wheel_Iterator_T<ACE_Handler *,
00132     ACE_Proactor_Handle_Timeout_Upcall,
00133     ACE_SYNCH_RECURSIVE_MUTEX>
00134   TIMER_WHEEL_ITERATOR;
00135 
00136   // = Friendship.
00137 
00138   /// Timer handler runs a thread and manages the timers, on behalf of
00139   /// the Proactor.
00140   friend class ACE_Proactor_Timer_Handler;
00141 
00142 public:
00143   /// Public type.
00144   typedef ACE_Timer_Queue_T<ACE_Handler *,
00145     ACE_Proactor_Handle_Timeout_Upcall,
00146     ACE_SYNCH_RECURSIVE_MUTEX>
00147   TIMER_QUEUE;
00148 
00149   /**
00150    * Constructor. If <implementation> is 0, the correct implementation
00151    * object will be created. <delete_implementation> flag determines
00152    * whether the implementation object should be deleted by the
00153    * Proactor or not. If <tq> is 0, a new TIMER_QUEUE is created.
00154    */
00155   ACE_Proactor (ACE_Proactor_Impl *implementation = 0,
00156                 int delete_implementation = 0,
00157                 TIMER_QUEUE *tq = 0);
00158 
00159   /// Virtual destruction.
00160   virtual ~ACE_Proactor (void);
00161 
00162   /// Get pointer to a process-wide <ACE_Proactor>.  <threads> should
00163   /// be part of another method.
00164   static ACE_Proactor *instance (size_t threads = 0);
00165 
00166   /// Set pointer to a process-wide <ACE_Proactor> and return existing
00167   /// pointer.
00168   static ACE_Proactor *instance (ACE_Proactor * proactor,
00169                                  int delete_proactor = 0);
00170 
00171   /// Delete the dynamically allocated Singleton.
00172   static void close_singleton (void);
00173 
00174   /// Cleanup method, used by the <ACE_Object_Manager> to destroy the
00175   /// singleton.
00176   static void cleanup (void *instance, void *arg);
00177 
00178   /// Name of dll in which the singleton instance lives.
00179   static const ACE_TCHAR *dll_name (void);
00180 
00181   /// Name of component--ACE_Proactor in this case.
00182   static const ACE_TCHAR *name (void);
00183 
00184   // = Proactor event loop management methods.
00185 
00186   /// Run the event loop until the <ACE_Proactor::handle_events> method
00187   /// returns -1 or the <end_event_loop> method is invoked.
00188   static int run_event_loop (void);
00189 
00190   /**
00191    * Run the event loop until the <ACE_Proactor::handle_events> method
00192    * returns -1, the <end_event_loop> method is invoked, or the
00193    * <ACE_Time_Value> expires.
00194    */
00195   static int run_event_loop (ACE_Time_Value &tv);
00196 
00197   /**
00198    * Instruct the <ACE_Proactor::instance> to terminate its event
00199    * loop.
00200    * This method wakes up all the threads blocked on waiting for
00201    * completions and end the event loop.
00202    */
00203   static int end_event_loop (void);
00204 
00205   /**
00206    * Resets the <ACE_Proactor::end_event_loop_> static so that the
00207    * <run_event_loop> method can be restarted.
00208    */
00209   static int reset_event_loop (void);
00210 
00211   /**
00212    * The singleton proactor is used by the <ACE_Service_Config>.
00213    * Therefore, we must check for the reconfiguration request and
00214    * handle it after handling an event.
00215    */
00216   static int check_reconfiguration (ACE_Proactor *);
00217 
00218   /// Report if the <ACE_Proactor::instance> event loop is finished.
00219   static int event_loop_done (void);
00220 
00221   /// Close the associated @c ACE_Proactor_Impl implementation object.
00222   /**
00223    * If @arg delete_implementation was specified to the @c open() method,
00224    * the implementation object is also deleted.
00225    */
00226   virtual int close (void);
00227 
00228    /**
00229    * You can add a hook to various run_event methods and the hook will
00230    * be called after handling every proactor event.  If this function
00231    * returns 0, proactor_run_event_loop will check for the return value of
00232    * handle_events.  If it is -1, the the proactor_run_event_loop will return
00233    * (pre-maturely.)
00234    */
00235   typedef int (*PROACTOR_EVENT_HOOK)(ACE_Proactor *);
00236 
00237   // These methods work with an instance of a proactor.
00238   /**
00239    * Run the event loop until the
00240    * <ACE_Proactor::handle_events>
00241    * method returns -1 or the <end_proactor_event_loop> method is invoked.
00242    */
00243   virtual int proactor_run_event_loop (PROACTOR_EVENT_HOOK = 0);
00244 
00245   /**
00246    * Run the event loop until the <ACE_Proactor::handle_events>
00247    * method returns -1, the
00248    * <end_proactor_event_loop> method is invoked,
00249    * or the <ACE_Time_Value>
00250    * expires.
00251    */
00252   virtual int proactor_run_event_loop (ACE_Time_Value &tv,
00253                                        PROACTOR_EVENT_HOOK = 0);
00254 
00255   /**
00256    * Instruct the ACE_Proactor to terminate its event loop
00257    * and notifies the ACE_Proactor so that it can wake up
00258    * and close down gracefully.
00259    */
00260   virtual int proactor_end_event_loop (void);
00261 
00262   /// Report if the ACE_Proactor event loop is finished.
00263   virtual int proactor_event_loop_done (void);
00264 
00265   /// Resets the <ACE_Proactor::end_event_loop_> static so that the
00266   /// <run_event_loop> method can be restarted.
00267   virtual int proactor_reset_event_loop (void);
00268 
00269 
00270   /// This method adds the <handle> to the I/O completion port. This
00271   /// function is a no-op function for Unix systems and returns 0;
00272   virtual int register_handle (ACE_HANDLE handle,
00273                                const void *completion_key);
00274 
00275   // = Timer management.
00276   /**
00277    * Schedule a <handler> that will expire after <time>.  If it
00278    * expires then <act> is passed in as the value to the <handler>'s
00279    * <handle_timeout> callback method.  This method returns a
00280    * <timer_id>. This <timer_id> can be used to cancel a timer before
00281    * it expires.  The cancellation ensures that <timer_ids> are unique
00282    * up to values of greater than 2 billion timers.  As long as timers
00283    * don't stay around longer than this there should be no problems
00284    * with accidentally deleting the wrong timer.  Returns -1 on
00285    * failure (which is guaranteed never to be a valid <timer_id>).
00286    */
00287   virtual long schedule_timer (ACE_Handler &handler,
00288                                const void *act,
00289                                const ACE_Time_Value &time);
00290 
00291   virtual long schedule_repeating_timer (ACE_Handler &handler,
00292                                          const void *act,
00293                                          const ACE_Time_Value &interval);
00294 
00295   // Same as above except <interval> it is used to reschedule the
00296   // <handler> automatically.
00297 
00298   /// This combines the above two methods into one. Mostly for backward
00299   /// compatibility.
00300   virtual long schedule_timer (ACE_Handler &handler,
00301                                const void *act,
00302                                const ACE_Time_Value &time,
00303                                const ACE_Time_Value &interval);
00304 
00305   /// Cancel all timers associated with this <handler>.  Returns number
00306   /// of timers cancelled.
00307   virtual int cancel_timer (ACE_Handler &handler,
00308                             int dont_call_handle_close = 1);
00309 
00310   /**
00311    * Cancel the single <ACE_Handler> that matches the <timer_id> value
00312    * (which was returned from the <schedule> method).  If <act> is
00313    * non-NULL then it will be set to point to the ``magic cookie''
00314    * argument passed in when the <Handler> was registered.  This makes
00315    * it possible to free up the memory and avoid memory leaks.
00316    * Returns 1 if cancellation succeeded and 0 if the <timer_id>
00317    * wasn't found.
00318    */
00319   virtual int cancel_timer (long timer_id,
00320                             const void **act = 0,
00321                             int dont_call_handle_close = 1);
00322 
00323   /**
00324    * Dispatch a single set of events, waiting up to a specified time limit
00325    * if necessary.
00326    * @param wait_time the time to wait for an event to occur. This is
00327    * a relative time. On successful return, the time is updated to
00328    * reflect the amount of time spent waiting for event(s) to occur.
00329    * @return Returns 0 if no events occur before the wait_time expires.
00330    * Returns 1 when a completion is dispatched. On error, returns -1
00331    * and sets errno accordingly.
00332    */
00333   virtual int handle_events (ACE_Time_Value &wait_time);
00334 
00335   /**
00336    * Block indefinitely until at least one event is dispatched.
00337    * @return Returns 1 when a completion is dispatched. On error, returns -1
00338    * and sets errno accordingly.
00339    */
00340   virtual int handle_events (void);
00341 
00342   /// Add wakeup dispatch threads (reinit).
00343   int wake_up_dispatch_threads (void);
00344 
00345   /// Close all dispatch threads.
00346   int close_dispatch_threads (int wait);
00347 
00348   /// Get number of thread used as a parameter to CreatIoCompletionPort.
00349   size_t number_of_threads (void) const;
00350 
00351   /// Set number of thread used as a parameter to CreatIoCompletionPort.
00352   void number_of_threads (size_t threads);
00353 
00354   /// Get timer queue.
00355   TIMER_QUEUE *timer_queue (void) const;
00356 
00357   /// Set timer queue.
00358   void timer_queue (TIMER_QUEUE *timer_queue);
00359 
00360   /**
00361    * Get the event handle.
00362    * It is a no-op in POSIX platforms and it returns
00363    * ACE_INVALID_HANDLE.
00364    */
00365   virtual ACE_HANDLE get_handle (void) const;
00366 
00367   /// Get the implementation class.
00368   virtual ACE_Proactor_Impl *implementation (void) const;
00369 
00370   // = Factory methods for the operations
00371 
00372   // Note that the user does not have to use or know about these
00373   // methods.
00374 
00375   /// Create the correct implementation class for doing
00376   /// Asynch_Read_Stream.
00377   virtual ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void);
00378 
00379   /// Create the correct implementation class for doing
00380   /// Asynch_Write_Stream.
00381   virtual ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void);
00382 
00383   /// Create the correct implementation class for doing
00384   /// Asynch_Read_File.
00385   virtual ACE_Asynch_Read_File_Impl *create_asynch_read_file (void);
00386 
00387   /// Create the correct implementation class for doing
00388   /// Asynch_Write_File.
00389   virtual ACE_Asynch_Write_File_Impl *create_asynch_write_file (void);
00390 
00391   /// Create the correct implementation class for doing Asynch_Accept.
00392   virtual ACE_Asynch_Accept_Impl *create_asynch_accept (void);
00393 
00394   /// Create the correct implementation class for doing Asynch_Connect.
00395   virtual ACE_Asynch_Connect_Impl *create_asynch_connect (void);
00396 
00397   /// Create the correct implementation class for doing
00398   /// Asynch_Transmit_File.
00399   virtual ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void);
00400 
00401   /// Create the correct implementation class for doing
00402   /// Asynch_Read_Dgram.
00403   virtual ACE_Asynch_Read_Dgram_Impl *create_asynch_read_dgram (void);
00404 
00405   /// Create the correct implementation class for doing
00406   /// Asynch_Write_Dgram.
00407   virtual ACE_Asynch_Write_Dgram_Impl *create_asynch_write_dgram (void);
00408 
00409   // = Factory methods for the results
00410 
00411   // Note that the user does not have to use or know about these
00412   // methods unless they want to "fake" results.
00413 
00414   /// Create the correct implementation class for
00415   /// ACE_Asynch_Read_Stream::Result class.
00416   virtual ACE_Asynch_Read_Stream_Result_Impl *
00417     create_asynch_read_stream_result (ACE_Handler &handler,
00418                                       ACE_HANDLE handle,
00419                                       ACE_Message_Block &message_block,
00420                                       u_long bytes_to_read,
00421                                       const void* act,
00422                                       ACE_HANDLE event = ACE_INVALID_HANDLE,
00423                                       int priority = 0,
00424                                       int signal_number = ACE_SIGRTMIN);
00425 
00426   /// Create the correct implementation class for
00427   /// ACE_Asynch_Write_Stream::Result.
00428   virtual ACE_Asynch_Write_Stream_Result_Impl *
00429     create_asynch_write_stream_result (ACE_Handler &handler,
00430                                        ACE_HANDLE handle,
00431                                        ACE_Message_Block &message_block,
00432                                        u_long bytes_to_write,
00433                                        const void* act,
00434                                        ACE_HANDLE event = ACE_INVALID_HANDLE,
00435                                        int priority = 0,
00436                                        int signal_number = ACE_SIGRTMIN);
00437 
00438   /// Create the correct implementation class for
00439   /// ACE_Asynch_Read_File::Result.
00440   virtual ACE_Asynch_Read_File_Result_Impl *
00441     create_asynch_read_file_result (ACE_Handler &handler,
00442                                     ACE_HANDLE handle,
00443                                     ACE_Message_Block &message_block,
00444                                     u_long bytes_to_read,
00445                                     const void* act,
00446                                     u_long offset,
00447                                     u_long offset_high,
00448                                     ACE_HANDLE event = ACE_INVALID_HANDLE,
00449                                     int priority = 0,
00450                                     int signal_number = ACE_SIGRTMIN);
00451 
00452   /// Create the correct implementation class for
00453   /// ACE_Asynch_Write_File::Result.
00454   virtual ACE_Asynch_Write_File_Result_Impl *
00455     create_asynch_write_file_result (ACE_Handler &handler,
00456                                      ACE_HANDLE handle,
00457                                      ACE_Message_Block &message_block,
00458                                      u_long bytes_to_write,
00459                                      const void* act,
00460                                      u_long offset,
00461                                      u_long offset_high,
00462                                      ACE_HANDLE event = ACE_INVALID_HANDLE,
00463                                      int priority = 0,
00464                                      int signal_number = ACE_SIGRTMIN);
00465 
00466   /// Create the correct implementation class for
00467   /// ACE_Asynch_Read_Dgram::Result.
00468   virtual ACE_Asynch_Read_Dgram_Result_Impl *
00469     create_asynch_read_dgram_result (ACE_Handler &handler,
00470                                      ACE_HANDLE handle,
00471                                      ACE_Message_Block *message_block,
00472                                      size_t bytes_to_read,
00473                                      int flags,
00474                                      int protocol_family,
00475                                      const void* act,
00476                                      ACE_HANDLE event = ACE_INVALID_HANDLE,
00477                                      int priority = 0,
00478                                      int signal_number = ACE_SIGRTMIN);
00479 
00480   /// Create the correct implementation class for
00481   /// ACE_Asynch_Write_Dgram::Result.
00482   virtual ACE_Asynch_Write_Dgram_Result_Impl *
00483     create_asynch_write_dgram_result (ACE_Handler &handler,
00484                                       ACE_HANDLE handle,
00485                                       ACE_Message_Block *message_block,
00486                                       size_t bytes_to_write,
00487                                       int flags,
00488                                       const void* act,
00489                                       ACE_HANDLE event = ACE_INVALID_HANDLE,
00490                                       int priority = 0,
00491                                       int signal_number = ACE_SIGRTMIN);
00492 
00493   /// Create the correct implementation class for ACE_Asynch_Accept::Result.
00494   virtual ACE_Asynch_Accept_Result_Impl *
00495     create_asynch_accept_result (ACE_Handler &handler,
00496                                  ACE_HANDLE listen_handle,
00497                                  ACE_HANDLE accept_handle,
00498                                  ACE_Message_Block &message_block,
00499                                  u_long bytes_to_read,
00500                                  const void* act,
00501                                  ACE_HANDLE event = ACE_INVALID_HANDLE,
00502                                  int priority = 0,
00503                                  int signal_number = ACE_SIGRTMIN);
00504 
00505   /// Create the correct implementation class for ACE_Asynch_Connect::Result
00506   virtual ACE_Asynch_Connect_Result_Impl *
00507     create_asynch_connect_result (ACE_Handler &handler,
00508                                   ACE_HANDLE  connect_handle,
00509                                   const void* act,
00510                                   ACE_HANDLE event = ACE_INVALID_HANDLE,
00511                                   int priority = 0,
00512                                   int signal_number = ACE_SIGRTMIN);
00513 
00514   /// Create the correct implementation class for
00515   /// ACE_Asynch_Transmit_File::Result.
00516   virtual ACE_Asynch_Transmit_File_Result_Impl *
00517     create_asynch_transmit_file_result (ACE_Handler &handler,
00518                                         ACE_HANDLE socket,
00519                                         ACE_HANDLE file,
00520                                         ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
00521                                         u_long bytes_to_write,
00522                                         u_long offset,
00523                                         u_long offset_high,
00524                                         u_long bytes_per_send,
00525                                         u_long flags,
00526                                         const void *act,
00527                                         ACE_HANDLE event = ACE_INVALID_HANDLE,
00528                                         int priority = 0,
00529                                         int signal_number = ACE_SIGRTMIN);
00530 
00531   /**
00532    * Create a timer result object which can be used with the Timer
00533    * mechanism of the Proactor.
00534    * If <signal_number> is -1, <POSIX_SIG_Proactor> will create a
00535    * Timer object with a meaningful signal number, choosing the
00536    * largest signal number from the signal mask of the Proactor.
00537    */
00538   virtual ACE_Asynch_Result_Impl *create_asynch_timer (ACE_Handler &handler,
00539                                                        const void *act,
00540                                                        const ACE_Time_Value &tv,
00541                                                        ACE_HANDLE event = ACE_INVALID_HANDLE,
00542                                                        int priority = 0,
00543                                                        int signal_number = ACE_SIGRTMIN);
00544 
00545 protected:
00546 
00547   /**
00548    * Post <how_many> completions to the completion port so that all
00549    * threads can wake up. This is used in conjunction with the
00550    * <run_event_loop>.
00551    */
00552   static int post_wakeup_completions (int how_many);
00553 
00554   /**
00555    * Post <how_many> completions to the completion port so that all
00556    * threads can wake up. This is used in conjunction with the
00557    * <proactor_run_event_loop>.
00558    */
00559   virtual int proactor_post_wakeup_completions (int how_many);
00560 
00561   /// Set the implementation class.
00562   virtual void implementation (ACE_Proactor_Impl *implementation);
00563 
00564   /// Delegation/implementation class that all methods will be
00565   /// forwarded to.
00566   ACE_Proactor_Impl *implementation_;
00567 
00568   /// Flag used to indicate whether we are responsible for cleaning up
00569   /// the implementation instance.
00570   int delete_implementation_;
00571 
00572   /// Pointer to a process-wide <ACE_Proactor>.
00573   static ACE_Proactor *proactor_;
00574 
00575   /// Must delete the <proactor_> if non-0.
00576   static int delete_proactor_;
00577 
00578   /// Handles timeout events.
00579   ACE_Proactor_Timer_Handler *timer_handler_;
00580 
00581   /// This will manage the thread in the Timer_Handler.
00582   ACE_Thread_Manager thr_mgr_;
00583 
00584   /// Timer Queue.
00585   TIMER_QUEUE *timer_queue_;
00586 
00587   /// Flag on whether to delete the timer queue.
00588   int delete_timer_queue_;
00589 
00590   /// Terminate the proactor event loop.
00591   sig_atomic_t end_event_loop_;
00592 
00593   /// Number of threads in the event loop.
00594   sig_atomic_t event_loop_thread_count_;
00595 
00596   /// Mutex to protect work with lists.
00597   ACE_SYNCH_MUTEX mutex_;
00598 
00599 
00600 private:
00601   /// Deny access since member-wise won't work...
00602   ACE_Proactor (const ACE_Proactor &);
00603   ACE_Proactor &operator= (const ACE_Proactor &);
00604 };
00605 
00606 #  if defined (__ACE_INLINE__)
00607 #    include "ace/Proactor.i"
00608 #  endif /* __ACE_INLINE__ */
00609 
00610 #else /* NOT WIN32 or POSIX with AIO features. */
00611 
00612 class ACE_Time_Value;
00613 
00614 class ACE_Export ACE_Proactor
00615 {
00616 public:
00617   class Timer_Queue {};
00618   ACE_Proactor (size_t /* number_of_threads */ = 0,
00619                 Timer_Queue * /* tq */ = 0) {}
00620   virtual int handle_events (void) { return -1; }
00621   virtual int handle_events (ACE_Time_Value &) { return -1; }
00622 
00623   /// Placeholder to enable compilation on non-Win32 platforms
00624   static ACE_Proactor *instance (size_t threads = 0);
00625 
00626   /// Placeholder to enable compilation on non-Win32 platforms
00627   static ACE_Proactor *instance (ACE_Proactor *);
00628 
00629   /// Placeholder to enable compilation on non-Win32 platforms
00630   static void close_singleton (void);
00631 
00632   /// Placeholder to enable compilation on non-Win32 platforms
00633   static int run_event_loop (void);
00634 
00635   /// Placeholder to enable compilation on non-Win32 platforms
00636   static int run_event_loop (ACE_Time_Value &tv);
00637 
00638   /// Placeholder to enable compilation on non-Win32 platforms
00639   static int end_event_loop (void);
00640 
00641   /// Placeholder to enable compilation on non-Win32 platforms
00642   static sig_atomic_t event_loop_done (void);
00643 };
00644 
00645 #endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS*/
00646 
00647 #include "ace/post.h"
00648 
00649 #endif /* ACE_PROACTOR_H */

Generated on Mon Jun 16 11:20:53 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002