00001
00002
00003 #include "ace/Msg_WFMO_Reactor.h"
00004
00005 ACE_RCSID(ace, Msg_WFMO_Reactor, "$Id: Msg_WFMO_Reactor.cpp 76373 2007-01-06 00:13:33Z shuston $")
00006
00007 #if defined (ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
00008
00009 #if !defined (__ACE_INLINE__)
00010 #include "ace/Msg_WFMO_Reactor.inl"
00011 #endif
00012
00013 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00014
00015 ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (ACE_Sig_Handler *sh,
00016 ACE_Timer_Queue *tq)
00017 : ACE_WFMO_Reactor (sh, tq)
00018 {
00019 }
00020
00021 ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (size_t size,
00022 int unused,
00023 ACE_Sig_Handler *sh,
00024 ACE_Timer_Queue *tq)
00025 : ACE_WFMO_Reactor (size, unused, sh, tq)
00026 {
00027 }
00028
00029 ACE_Msg_WFMO_Reactor::~ACE_Msg_WFMO_Reactor (void)
00030 {
00031 }
00032
00033 DWORD
00034 ACE_Msg_WFMO_Reactor::wait_for_multiple_events (int timeout,
00035 int alertable)
00036 {
00037
00038
00039
00040
00041
00042 return ::MsgWaitForMultipleObjectsEx (this->handler_rep_.max_handlep1 (),
00043 this->handler_rep_.handles (),
00044 timeout,
00045 QS_ALLINPUT,
00046 alertable);
00047 }
00048
00049 int
00050 ACE_Msg_WFMO_Reactor::dispatch_window_messages (void)
00051 {
00052 int number_of_messages = 0;
00053 MSG msg;
00054
00055
00056 while (::PeekMessage (&msg, 0, 0, 0, PM_REMOVE))
00057 {
00058 ::TranslateMessage (&msg);
00059 if (msg.message == WM_QUIT)
00060 {
00061
00062 ::PostQuitMessage (LOWORD (msg.wParam));
00063 return -1;
00064 }
00065
00066 ::DispatchMessage (&msg);
00067 ++number_of_messages;
00068 }
00069
00070 return number_of_messages;
00071 }
00072
00073 DWORD
00074 ACE_Msg_WFMO_Reactor::poll_remaining_handles (DWORD slot)
00075 {
00076 return ::MsgWaitForMultipleObjects (this->handler_rep_.max_handlep1 () - slot,
00077 this->handler_rep_.handles () + slot,
00078 FALSE,
00079 0,
00080 QS_ALLINPUT);
00081 }
00082
00083 ACE_END_VERSIONED_NAMESPACE_DECL
00084
00085 #endif