3 //=============================================================================
5 * @file Msg_WFMO_Reactor.h
7 * @author Beskrovny Evgeny <evgeny_beskrovny@icomverse.com>
8 * @author Irfan Pyarali <irfan@cs.wustl.edu>
10 //=============================================================================
13 #ifndef ACE_MSG_WFMO_REACTOR_H
14 #define ACE_MSG_WFMO_REACTOR_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "ace/ACE_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #if defined (ACE_WIN32)
25 #include "ace/WFMO_Reactor.h"
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 * @class ACE_Msg_WFMO_Reactor
32 * @brief An OO event demultiplexor and event handler dispatcher for
33 * Win32 <MsgWaitForMultipleObjects>.
35 * The ACE_Msg_WFMO_Reactor is an OO event demultiplexor and
36 * event handler Reactor. It differs from ACE_WFMO_Reactor by
37 * its ability to react on Windows messages. It is needed when
38 * the task should serve also as a COM/DCOM server.
40 class ACE_Export ACE_Msg_WFMO_Reactor
: public ACE_WFMO_Reactor
43 /// Initialize ACE_Msg_WFMO_Reactor with the default size.
44 ACE_Msg_WFMO_Reactor (ACE_Sig_Handler
* = 0,
45 ACE_Timer_Queue
* = 0);
48 * Initialize ACE_Msg_WFMO_Reactor with size @a size. Two slots will be
49 * added to the @a size parameter which will store handles used for
50 * internal management purposes.
52 ACE_Msg_WFMO_Reactor (size_t size
,
54 ACE_Sig_Handler
* = 0,
55 ACE_Timer_Queue
* = 0);
57 /// Close down the ACE_Msg_WFMO_Reactor and release all of its resources.
58 virtual ~ACE_Msg_WFMO_Reactor ();
61 * This event loop driver blocks for up to @a max_wait_time before
62 * returning. It will return earlier if timer events, I/O events,
63 * window events, or signal events occur. Note that @a max_wait_time
64 * can be 0, in which case this method blocks indefinitely until
67 * @a max_wait_time is decremented to reflect how much time this call
68 * took. For instance, if a time value of 3 seconds is passed to
69 * handle_events and an event occurs after 2 seconds,
70 * @a max_wait_time will equal 1 second. This can be used if an
71 * application wishes to handle events for some fixed amount of
74 * <MsgWaitForMultipleObjects> is used as the demultiplexing call
76 * Returns the total number of ACE_Event_Handlers that were
77 * dispatched, 0 if the @a max_wait_time elapsed without dispatching
78 * any handlers, or -1 if an error occurs.
80 * The only difference between <alertable_handle_events> and
81 * <handle_events> is that in the alertable case, MWMO_ALERTABLE is
82 * passed to <MsgWaitForMultipleObjects> for the <bAlertable>
85 virtual int handle_events (ACE_Time_Value
*max_wait_time
= 0);
86 virtual int alertable_handle_events (ACE_Time_Value
*max_wait_time
= 0);
89 * This method is just like the one above, except the
90 * @a max_wait_time value is a reference and can therefore never be
93 virtual int handle_events (ACE_Time_Value
&max_wait_time
);
94 virtual int alertable_handle_events (ACE_Time_Value
&max_wait_time
);
97 /// Wait for timer and I/O events to occur.
98 virtual DWORD
wait_for_multiple_events (int timeout
,
101 /// Check for activity on remaining handles.
102 virtual DWORD
poll_remaining_handles (DWORD index
);
104 /// Dispatches window messages.
105 virtual int dispatch_window_messages ();
108 ACE_END_VERSIONED_NAMESPACE_DECL
110 #if defined (__ACE_INLINE__)
111 #include "ace/Msg_WFMO_Reactor.inl"
112 #endif /* __ACE_INLINE__ */
114 #endif /* ACE_WIN32 */
116 #include /**/ "ace/post.h"
117 #endif /* ACE_MSG_WFMO_REACTOR_H */