Fixed typos
[ACE_TAO.git] / ACE / ace / POSIX_CB_Proactor.h
blobe38360f5f9fbdfae035c39d8e59668d40ae6f177
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"
26 #include "ace/POSIX_Proactor.h"
29 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
31 /**
32 * @class ACE_POSIX_CB_Proactor
34 * @brief Implementation of Callback-based Proactor
35 * };
37 class ACE_Export ACE_POSIX_CB_Proactor : public ACE_POSIX_AIOCB_Proactor
40 public:
41 virtual Proactor_Type get_impl_type (void);
43 /// Destructor.
44 virtual ~ACE_POSIX_CB_Proactor (void);
46 /// Constructor defines max number asynchronous operations that can
47 /// be started at the same time.
48 ACE_POSIX_CB_Proactor (size_t max_aio_operations = ACE_AIO_DEFAULT_SIZE);
50 // This only public so the "extern C" completion function can see it
51 // when needed.
52 static void aio_completion_func (sigval cb_data);
54 protected:
56 /**
57 * Dispatch a single set of events. If @a wait_time elapses before
58 * any events occur, return 0. Return 1 on success i.e., when a
59 * completion is dispatched, non-zero (-1) on errors and errno is
60 * set accordingly.
62 virtual int handle_events (ACE_Time_Value &wait_time);
64 /**
65 * Block indefinitely until at least one event is dispatched.
66 * Dispatch a single set of events. If @a wait_time elapses before
67 * any events occur, return 0. Return 1 on success i.e., when a
68 * completion is dispatched, non-zero (-1) on errors and errno is
69 * set accordingly.
71 virtual int handle_events (void);
73 /// Find free slot to store result and aiocb pointer
74 virtual ssize_t allocate_aio_slot (ACE_POSIX_Asynch_Result *result);
76 /// Notify queue of "post_completed" ACE_POSIX_Asynch_Results
77 /// called from post_completion method
78 virtual int notify_completion (int sig_num);
80 /**
81 * Dispatch a single set of events. If @a milli_seconds elapses
82 * before any events occur, return 0. Return 1 if a completion is
83 * dispatched. Return -1 on errors.
85 int handle_events_i (u_long milli_seconds);
87 /// Semaphore variable to notify
88 /// used to wait the first AIO start
89 ACE_SYNCH_SEMAPHORE sema_;
92 ACE_END_VERSIONED_NAMESPACE_DECL
94 #endif /* ACE_HAS_AIO_CALLS */
95 #endif /* ACE_POSIX_CB_PROACTOR_H*/