1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#include "ace/Msg_WFMO_Reactor.h"
#if defined (ACE_WIN32)
#if !defined (__ACE_INLINE__)
#include "ace/Msg_WFMO_Reactor.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (ACE_Sig_Handler *sh,
ACE_Timer_Queue *tq)
: ACE_WFMO_Reactor (sh, tq)
{
}
ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (size_t size,
int unused,
ACE_Sig_Handler *sh,
ACE_Timer_Queue *tq)
: ACE_WFMO_Reactor (size, unused, sh, tq)
{
}
ACE_Msg_WFMO_Reactor::~ACE_Msg_WFMO_Reactor ()
{
}
DWORD
ACE_Msg_WFMO_Reactor::wait_for_multiple_events (int timeout,
int alertable)
{
// Wait for any of handles_ to be active, or until timeout expires.
// If <alertable> is enabled allow asynchronous completion of
// ReadFile and WriteFile operations. QS_ALLINPUT allows
// <MsgWaitForMultipleObjectsEx> to wait for any message is in the
// queue.
return ::MsgWaitForMultipleObjectsEx (this->handler_rep_.max_handlep1 (),
this->handler_rep_.handles (),
timeout,
QS_ALLINPUT,
alertable);
}
int
ACE_Msg_WFMO_Reactor::dispatch_window_messages ()
{
int number_of_messages = 0;
MSG msg;
// Process all pending message from this thread's message queue
while (::PeekMessage (&msg, 0, 0, 0, PM_REMOVE))
{
::TranslateMessage (&msg);
if (msg.message == WM_QUIT)
{
// Should inform the main thread
::PostQuitMessage (LOWORD (msg.wParam));
return -1;
}
::DispatchMessage (&msg);
++number_of_messages;
}
return number_of_messages;
}
DWORD
ACE_Msg_WFMO_Reactor::poll_remaining_handles (DWORD slot)
{
return ::MsgWaitForMultipleObjects (this->handler_rep_.max_handlep1 () - slot,
this->handler_rep_.handles () + slot,
FALSE,
0,
QS_ALLINPUT);
}
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_WIN32 */
|