00001
00002
00003 #include "ace/Msg_WFMO_Reactor.h"
00004
00005 ACE_RCSID(ace, Msg_WFMO_Reactor, "Msg_WFMO_Reactor.cpp,v 4.19 2006/04/19 11:53:23 jwillemsen Exp")
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 #if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))
00043 return ::MsgWaitForMultipleObjectsEx (this->handler_rep_.max_handlep1 (),
00044 this->handler_rep_.handles (),
00045 timeout,
00046 QS_ALLINPUT,
00047 alertable);
00048 #else
00049 ACE_UNUSED_ARG (alertable);
00050 return ::MsgWaitForMultipleObjects (this->handler_rep_.max_handlep1 (),
00051 this->handler_rep_.handles (),
00052 FALSE,
00053 timeout,
00054 QS_ALLINPUT);
00055 #endif
00056 }
00057
00058 int
00059 ACE_Msg_WFMO_Reactor::dispatch_window_messages (void)
00060 {
00061 int number_of_messages = 0;
00062 MSG msg;
00063
00064
00065 while (::PeekMessage (&msg, 0, 0, 0, PM_REMOVE))
00066 {
00067 ::TranslateMessage (&msg);
00068 if (msg.message == WM_QUIT)
00069 {
00070
00071 ::PostQuitMessage (msg.wParam);
00072 return -1;
00073 }
00074
00075 ::DispatchMessage (&msg);
00076 ++number_of_messages;
00077 }
00078
00079 return number_of_messages;
00080 }
00081
00082 DWORD
00083 ACE_Msg_WFMO_Reactor::poll_remaining_handles (DWORD slot)
00084 {
00085 return ::MsgWaitForMultipleObjects (this->handler_rep_.max_handlep1 () - slot,
00086 this->handler_rep_.handles () + slot,
00087 FALSE,
00088 0,
00089 QS_ALLINPUT);
00090 }
00091
00092 ACE_END_VERSIONED_NAMESPACE_DECL
00093
00094 #endif