[Ace-users] Timer is never called using the ACE_Reactor on Windows
CE 4.2
Bjoern
bjoern.d.rasmussen at gmail.com
Sun Aug 12 14:41:09 CDT 2007
ACE VERSION: 5.5.4
HOST MACHINE and OPERATING SYSTEM:
Windows CE 4.2 (Pocket PC 2003)
COMPILER NAME AND VERSION (AND PATCHLEVEL):
Visual Studio 2005 SP1 (Pocket PC 2003 SDK)
THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
specific file, simply state which one]:
#include "config-win32.h"
AREA/CLASS/EXAMPLE AFFECTED:
ACE_Reactor (ACE_WFMO_Reactor I assume)
DOES THE PROBLEM AFFECT:
COMPILATION?
LINKING?
EXECUTION?
Yes
OTHER (please specify)?
SYNOPSIS:
If I schedule a timer on an ACE_Reactor in Windows CE, the timer is
never called.
DESCRIPTION:
It seems the ACE_WFMO_Reactor doesn't work on Windows CE 4.2. If I
schedule a timer on an ACE_Reactor the timer's event handler is never
called. I currently use ACE 5.5.4 but I've also tried ACE 5.5.10,
which I can see has some changes in WFMO_Reactor.cpp, but it also
fails to call the timer. I've been reading this post for a workaround:
http://groups.google.com/group/comp.soft-sys.ace/browse_thread/thread/d5d2500cd6d4d493/815b8bac44670f98?lnk=gst&q=ace+5.5+windowsce&rnum=3&hl=en
But the timer is still not called with the above fix for ACE 5.5.4.
Are anyone using the ACE_Reactor successfully on Windows CE?
REPEAT BY:
I've pasted a Win32 app for Windows CE at this end of this post.
SAMPLE FIX/WORKAROUND:
None that I'm aware of.
Kind regards
Bjoern D. Rasmussen
Win32 sample application which fails to call the TimerHandler class
using the ACE_Reactor:
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include <ace/ACE.h>
#include <ace/Reactor.h>
#include <ace/Thread_Manager.h>
#include <ace/Event_Handler.h>
class TimerHandler : public ACE_Event_Handler
{
public:
virtual int handle_timeout(const ACE_Time_Value& tv, const void* arg)
{
OutputDebugString(_T("TIMER EVENT\r\n"));
return 0;
}
virtual int handle_close(ACE_HANDLE handle, ACE_Reactor_Mask
close_mask)
{
delete this;
return 0;
}
};
static ACE_THR_FUNC_RETURN event_loop (void *arg)
{
ACE_Reactor::instance()->owner (ACE_OS::thr_self ());
ACE_Reactor::instance()->run_reactor_event_loop ();
return 0;
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR lpCmdLine,
int nCmdShow)
{
int ret;
ret = ACE::init();
ret = ACE_Thread_Manager::instance ()->spawn(event_loop, 0);
ACE_Time_Value interval(1);
ret = ACE_Reactor::instance()->schedule_timer(new TimerHandler(), 0,
interval, interval);
MessageBox(0, L"Wait for timer to do its work", L"Wait Dlg", MB_OK);
ACE_Reactor::instance()->end_reactor_event_loop();
return 0;
}
More information about the Ace-users
mailing list