Document return values
[ACE_TAO.git] / ACE / ace / POSIX_CB_Proactor.h
blob9aa8221c43b2774f0daa5b4e87a55afc33df08de
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file POSIX_CB_Proactor.h
7 * @author Alexander Libman <alibman@ihug.com.au>
8 */
9 //=============================================================================
11 #ifndef ACE_POSIX_CB_PROACTOR_H
12 #define ACE_POSIX_CB_PROACTOR_H
14 #include /**/ "ace/config-all.h"
16 #if !defined (ACE_LACKS_PRAGMA_ONCE)
17 # pragma once
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #if defined (ACE_HAS_AIO_CALLS)
22 #include "ace/Synch_Traits.h"
23 #include "ace/Thread_Semaphore.h"
24 #include "ace/Null_Semaphore.h"
25 #include "ace/POSIX_Proactor.h"
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
29 /**
30 * @class ACE_POSIX_CB_Proactor
32 * @brief Implementation of Callback-based Proactor
34 class ACE_Export ACE_POSIX_CB_Proactor : public ACE_POSIX_AIOCB_Proactor
36 public:
37 virtual Proactor_Type get_impl_type ();
39 /// Destructor.
40 virtual ~ACE_POSIX_CB_Proactor ();
42 /// Constructor defines max number asynchronous operations that can
43 /// be started at the same time.
44 ACE_POSIX_CB_Proactor (size_t max_aio_operations = ACE_AIO_DEFAULT_SIZE);
46 // This only public so the "extern C" completion function can see it
47 // when needed.
48 static void aio_completion_func (sigval cb_data);
50 protected:
51 /**
52 * Dispatch a single set of events. If @a wait_time elapses before
53 * any events occur, return 0. Return 1 on success i.e., when a
54 * completion is dispatched, non-zero (-1) on errors and errno is
55 * set accordingly.
57 virtual int handle_events (ACE_Time_Value &wait_time);
59 /**
60 * Block indefinitely until at least one event is dispatched.
61 * Dispatch a single set of events. If @a wait_time elapses before
62 * any events occur, return 0. Return 1 on success i.e., when a
63 * completion is dispatched, non-zero (-1) on errors and errno is
64 * set accordingly.
66 virtual int handle_events ();
68 /// Find free slot to store result and aiocb pointer
69 virtual ssize_t allocate_aio_slot (ACE_POSIX_Asynch_Result *result);
71 /// Notify queue of "post_completed" ACE_POSIX_Asynch_Results
72 /// called from post_completion method
73 virtual int notify_completion (int sig_num);
75 /**
76 * Dispatch a single set of events. If @a milli_seconds elapses
77 * before any events occur, return 0. Return 1 if a completion is
78 * dispatched. Return -1 on errors.
80 int handle_events_i (u_long milli_seconds);
82 /// Semaphore variable to notify
83 /// used to wait the first AIO start
84 ACE_SYNCH_SEMAPHORE sema_;
87 ACE_END_VERSIONED_NAMESPACE_DECL
89 #endif /* ACE_HAS_AIO_CALLS */
90 #endif /* ACE_POSIX_CB_PROACTOR_H*/