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

POSIX_CB_Proactor.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    POSIX_CB_Proactor.h
00006  *
00007  *  $Id: POSIX_CB_Proactor.h,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Alexander Libman <alibman@ihug.com.au>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_POSIX_CB_PROACTOR_H
00014 #define ACE_POSIX_CB_PROACTOR_H
00015 
00016 #include "ace/config-all.h"
00017 
00018 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00019 # pragma once
00020 #endif /* ACE_LACKS_PRAGMA_ONCE */
00021 
00022 #if defined (ACE_HAS_AIO_CALLS) && !defined(__sun) && !defined(__Lynx__)
00023 
00024 #include "ace/POSIX_Proactor.h"
00025 
00026 /**
00027  * @class ACE_POSIX_CB_Proactor
00028  *
00029  * @brief Implementation of Callback-based Proactor
00030  * };
00031  */
00032 class ACE_Export ACE_POSIX_CB_Proactor : public ACE_POSIX_AIOCB_Proactor
00033 {
00034 
00035 public:
00036   virtual Proactor_Type get_impl_type (void);
00037 
00038   /// Destructor.
00039   virtual ~ACE_POSIX_CB_Proactor (void);
00040 
00041   /// Constructor defines max number asynchronous operations that can
00042   /// be started at the same time.
00043   ACE_POSIX_CB_Proactor (size_t max_aio_operations = ACE_AIO_DEFAULT_SIZE);
00044 
00045 protected:
00046 
00047   static void aio_completion_func (sigval_t cb_data);
00048 
00049   /**
00050    * Dispatch a single set of events.  If <wait_time> elapses before
00051    * any events occur, return 0.  Return 1 on success i.e., when a
00052    * completion is dispatched, non-zero (-1) on errors and errno is
00053    * set accordingly.
00054    */
00055   virtual int handle_events (ACE_Time_Value &wait_time);
00056 
00057   /**
00058    * Block indefinitely until at least one event is dispatched.
00059    * Dispatch a single set of events.  If <wait_time> elapses before
00060    * any events occur, return 0.  Return 1 on success i.e., when a
00061    * completion is dispatched, non-zero (-1) on errors and errno is
00062    * set accordingly.
00063    */
00064   virtual int handle_events (void);
00065 
00066   /// Find free slot to store result and aiocb pointer
00067   virtual ssize_t allocate_aio_slot (ACE_POSIX_Asynch_Result *result);
00068 
00069   /// Notify queue of "post_completed" ACE_POSIX_Asynch_Results
00070   /// called from post_completion method
00071   virtual int notify_completion (int sig_num);
00072 
00073   /**
00074    * Dispatch a single set of events.  If <milli_seconds> elapses
00075    * before any events occur, return 0. Return 1 if a completion is
00076    * dispatched. Return -1 on errors.
00077    */
00078   int handle_events_i (u_long milli_seconds);
00079  
00080   /// semaphore variable to notify
00081   /// used to wait the first AIO start
00082   ACE_SYNCH_SEMAPHORE sema_;
00083 };
00084 
00085 #if defined (__ACE_INLINE__)
00086 #include "ace/POSIX_CB_Proactor.i"
00087 #endif /* __ACE_INLINE__ */
00088 
00089 #endif /* ACE_HAS_AIO_CALLS && !__sun && !__Lynx__ */
00090 #endif /* ACE_POSIX_CB_PROACTOR_H*/

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