Revert to Current Include Style
[ACE_TAO.git] / ACE / ace / Msg_WFMO_Reactor.cpp
blob7852dceade3aa50ef5f87d2a5c655597352a2cc1
1 #include "ace/Msg_WFMO_Reactor.h"
5 #if defined (ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
7 #if !defined (__ACE_INLINE__)
8 #include "ace/Msg_WFMO_Reactor.inl"
9 #endif /* __ACE_INLINE__ */
11 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
13 ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (ACE_Sig_Handler *sh,
14 ACE_Timer_Queue *tq)
15 : ACE_WFMO_Reactor (sh, tq)
19 ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (size_t size,
20 int unused,
21 ACE_Sig_Handler *sh,
22 ACE_Timer_Queue *tq)
23 : ACE_WFMO_Reactor (size, unused, sh, tq)
27 ACE_Msg_WFMO_Reactor::~ACE_Msg_WFMO_Reactor (void)
31 DWORD
32 ACE_Msg_WFMO_Reactor::wait_for_multiple_events (int timeout,
33 int alertable)
35 // Wait for any of handles_ to be active, or until timeout expires.
36 // If <alertable> is enabled allow asynchronous completion of
37 // ReadFile and WriteFile operations. QS_ALLINPUT allows
38 // <MsgWaitForMultipleObjectsEx> to wait for any message is in the
39 // queue.
40 return ::MsgWaitForMultipleObjectsEx (this->handler_rep_.max_handlep1 (),
41 this->handler_rep_.handles (),
42 timeout,
43 QS_ALLINPUT,
44 alertable);
47 int
48 ACE_Msg_WFMO_Reactor::dispatch_window_messages (void)
50 int number_of_messages = 0;
51 MSG msg;
53 // Process all pending message from this thread's message queue
54 while (::PeekMessage (&msg, 0, 0, 0, PM_REMOVE))
56 ::TranslateMessage (&msg);
57 if (msg.message == WM_QUIT)
59 // Should inform the main thread
60 ::PostQuitMessage (LOWORD (msg.wParam));
61 return -1;
64 ::DispatchMessage (&msg);
65 ++number_of_messages;
68 return number_of_messages;
71 DWORD
72 ACE_Msg_WFMO_Reactor::poll_remaining_handles (DWORD slot)
74 return ::MsgWaitForMultipleObjects (this->handler_rep_.max_handlep1 () - slot,
75 this->handler_rep_.handles () + slot,
76 FALSE,
78 QS_ALLINPUT);
81 ACE_END_VERSIONED_NAMESPACE_DECL
83 #endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */