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