Initial Patch of Auction House bot rev. 135
[auctionmangos.git] / dep / ACE_wrappers / ace / Msg_WFMO_Reactor.cpp
blobe06b698169fb861c5d9e0c4255321c14f81c67da
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,
16 ACE_Timer_Queue *tq)
17 : ACE_WFMO_Reactor (sh, tq)
21 ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (size_t size,
22 int unused,
23 ACE_Sig_Handler *sh,
24 ACE_Timer_Queue *tq)
25 : ACE_WFMO_Reactor (size, unused, sh, tq)
29 ACE_Msg_WFMO_Reactor::~ACE_Msg_WFMO_Reactor (void)
33 DWORD
34 ACE_Msg_WFMO_Reactor::wait_for_multiple_events (int timeout,
35 int alertable)
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
41 // queue.
42 return ::MsgWaitForMultipleObjectsEx (this->handler_rep_.max_handlep1 (),
43 this->handler_rep_.handles (),
44 timeout,
45 QS_ALLINPUT,
46 alertable);
49 int
50 ACE_Msg_WFMO_Reactor::dispatch_window_messages (void)
52 int number_of_messages = 0;
53 MSG msg;
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));
63 return -1;
66 ::DispatchMessage (&msg);
67 ++number_of_messages;
70 return number_of_messages;
73 DWORD
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,
78 FALSE,
80 QS_ALLINPUT);
83 ACE_END_VERSIONED_NAMESPACE_DECL
85 #endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */