1 // $Id: Msg_WFMO_Reactor.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #include "ace/Msg_WFMO_Reactor.h"
5 ACE_RCSID(ace
, Msg_WFMO_Reactor
, "$Id: Msg_WFMO_Reactor.cpp 80826 2008-03-04 14:51:23Z wotte $")
7 #if defined (ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
9 #if !defined (__ACE_INLINE__)
10 #include "ace/Msg_WFMO_Reactor.inl"
11 #endif /* __ACE_INLINE__ */
13 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
15 ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (ACE_Sig_Handler
*sh
,
17 : ACE_WFMO_Reactor (sh
, tq
)
21 ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (size_t size
,
25 : ACE_WFMO_Reactor (size
, unused
, sh
, tq
)
29 ACE_Msg_WFMO_Reactor::~ACE_Msg_WFMO_Reactor (void)
34 ACE_Msg_WFMO_Reactor::wait_for_multiple_events (int timeout
,
37 // Wait for any of handles_ to be active, or until timeout expires.
38 // If <alertable> is enabled allow asynchronous completion of
39 // ReadFile and WriteFile operations. QS_ALLINPUT allows
40 // <MsgWaitForMultipleObjectsEx> to wait for any message is in the
42 return ::MsgWaitForMultipleObjectsEx (this->handler_rep_
.max_handlep1 (),
43 this->handler_rep_
.handles (),
50 ACE_Msg_WFMO_Reactor::dispatch_window_messages (void)
52 int number_of_messages
= 0;
55 // Process all pending message from this thread's message queue
56 while (::PeekMessage (&msg
, 0, 0, 0, PM_REMOVE
))
58 ::TranslateMessage (&msg
);
59 if (msg
.message
== WM_QUIT
)
61 // Should inform the main thread
62 ::PostQuitMessage (LOWORD (msg
.wParam
));
66 ::DispatchMessage (&msg
);
70 return number_of_messages
;
74 ACE_Msg_WFMO_Reactor::poll_remaining_handles (DWORD slot
)
76 return ::MsgWaitForMultipleObjects (this->handler_rep_
.max_handlep1 () - slot
,
77 this->handler_rep_
.handles () + slot
,
83 ACE_END_VERSIONED_NAMESPACE_DECL
85 #endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */