/* -*- C++ -*- */ // $Id$ // ============================================================================ // // = LIBRARY // ace // // = FILENAME // Proactor.h // // = AUTHOR // Irfan Pyarali (irfan@cs.wustl.edu), // Tim Harrison (harrison@cs.wustl.edu) and // Alexander Babu Arulanthu // // ============================================================================ #if !defined (ACE_PROACTOR_H) #define ACE_PROACTOR_H #include "ace/OS.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) // This only works on Win32 platforms and on Unix platforms supporting // POSIX aio calls. #include "ace/Asynch_IO.h" #include "ace/Asynch_IO_Impl.h" // Forward declarations. class ACE_Proactor_Impl; class ACE_Export ACE_Proactor { // = TITLE // A manager for asynchronous event demultiplexing. // // = DESCRIPTION // See the Proactor pattern description at // http://www.cs.wustl.edu/~schmidt/proactor.ps.gz for more // details. public: ACE_Proactor (ACE_Proactor_Impl *implementation = 0, int delete_implementation = 0); // A do nothing constructor. virtual ~ACE_Proactor (void); // Virtual destruction. static ACE_Proactor *instance (size_t threads = 0); // Get pointer to a process-wide . should // be part of another method. static ACE_Proactor *instance (ACE_Proactor *); // Set pointer to a process-wide and return existing // pointer. static void close_singleton (void); // Delete the dynamically allocated Singleton. // = Proactor event loop management methods. static int run_event_loop (void); // Run the event loop until the method // returns -1 or the method is invoked. static int run_event_loop (ACE_Time_Value &tv); // Run the event loop until the method // returns -1, the method is invoked, or the // expires. static int end_event_loop (void); // Instruct the to terminate its event // loop. static int event_loop_done (void); // Report if the event loop is finished. virtual int close (void); // Close the IO completion port. virtual int register_handle (ACE_HANDLE handle, const void *completion_key); // This method adds the to the I/O completion port. This // function is a no-op function for Unix systems. // = Timer management. virtual long schedule_timer (ACE_Handler &handler, const void *act, const ACE_Time_Value &time); // Schedule a that will expire after