Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Possible to put the WM_TIMER message in an other queue?

28 views
Skip to first unread message

Johan Machielse

unread,
Apr 26, 2000, 3:00:00 AM4/26/00
to
Hello,

Right now every 1 ms an event is signaled in the OnTimer() function and the
thread which is waiting on the event will resume. The problem is that not
exactly every 1 ms the OnTimer() function is called because the WM_TIMER
message is put in the messagequeue of the application. Is there a possible
way, that the produced WM_TIMER message (every 1 ms) is not put in de queue
of the application but in a queue of the thread? The thread then only has
WM_TIMER messages and no other messages so maybe I can guarantee the time of
1 ms???

Thank you,

Johan Machielse

Robert Metcalf

unread,
Apr 26, 2000, 3:00:00 AM4/26/00
to
I'm not sure but
mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VSa\10
33\vcmfc.chm::/html/_mfc_cwnd.3a3a.settimer.htm
in MSDN section seems to suggest a fn in your program wm_timer could call
without uging the messaging queue.

lpfnTimer
Specifies the address of the application-supplied TimerProc callback
function that processes the WM_TIMER messages. If this parameter is NULL,
the WM_TIMER messages are placed in the application's message queue and
handled by the CWnd object.

I thought about this when putting it into my gol prog.

--
----------------------------------------------------------
REMOVE all capital letters to email me

Sorry, but I've had another account end
up on all the junk lists, and it gets 40+
messages a day all junk :-(
"Johan Machielse" <JohanMa...@netscape.net> wrote in message
news:eKMsEU1r$GA.216@cppssbbsa03...

Jean-Marc MORIN

unread,
Apr 26, 2000, 3:00:00 AM4/26/00
to
You will *NEVER* get a 1ms guaranteed timer.

The granularity of WM_TIMER through SetTimer() API is 16ms, which mean
if you select 40ms to be awaken, it would happen arround 32 - 48 ms.
The minimum with SetTimer is therefore 16ms.

You need to use Multimedia Timer for a smaller resolution, but I guess anyhow
that you would never get 1ms guaranteed.

Jean-Marc

Richard Norman

unread,
Apr 26, 2000, 3:00:00 AM4/26/00
to
See my reply to your other post. You cannot achieve 1 msec responses
under Win32. The WM_TIMER is an especially poor choice because it is
a low priority message and is easily preempted by other messages which
could well take more than 1ms to execute. Besides, you message pump
itself will be preempted by other processes running on the machine which
occupy CPU time for more than 1 ms.

Johan Machielse <JohanMa...@netscape.net> wrote in message
news:eKMsEU1r$GA.216@cppssbbsa03...

Bob Moore

unread,
Apr 26, 2000, 3:00:00 AM4/26/00
to
On Wed, 26 Apr 2000 10:32:50 +0200, Jean-Marc MORIN wrote:

>You need to use Multimedia Timer for a smaller resolution, but I guess anyhow
>that you would never get 1ms guaranteed.

Correct. I ran a test using the performance counters to check the
resolution of multimedia timers and they're OK most of the time, but
sometimes the machine just goes away and plays with the fairies for a
while, and there's little you can about it, even if you up your thread
priority. I later found out that this was commonly the fault of
ATAPI.SYS, though I understand some badly written graphics drivers can
also disable interrupts for lengthy periods.

Bottom line is, Win32 ain't an RTOS.

--
Bob Moore [MVP]
http://www.mooremvp.freeserve.co.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Due to an unreasonable amount of queries, I no
longer answer unsolicited email questions. Sorry,
no exceptions.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kurt Grittner

unread,
Apr 27, 2000, 3:00:00 AM4/27/00
to
Hi Bob,

On Wed, 26 Apr 2000 21:29:22 +0100, Bob Moore <bo...@mvps.org> wrote:

>sometimes the machine just goes away and plays with the fairies for a
>while, and there's little you can about it, even if you up your thread
>priority.

The IDE controller can starve the CPU for extended periods as well. I
have lately started ordering SCSI drives for machines intended to run
this kind of program.

>Bottom line is, Win32 ain't an RTOS.

Amen, brother.

Regards,
Kurt

Joseph M. Newcomer

unread,
Apr 30, 2000, 3:00:00 AM4/30/00
to
This question comes up weekly (I should write an essay on it). Windows
is not a real-time system. Any PC with an IDE controller running
Windows cannot be a real-time system. Check out www.vci.com. They
support both NT and CE realtime.
joe

On Wed, 26 Apr 2000 09:59:53 +0200, "Johan Machielse"
<JohanMa...@netscape.net> wrote:

>Hello,
>
>Right now every 1 ms an event is signaled in the OnTimer() function and the
>thread which is waiting on the event will resume. The problem is that not
>exactly every 1 ms the OnTimer() function is called because the WM_TIMER
>message is put in the messagequeue of the application. Is there a possible
>way, that the produced WM_TIMER message (every 1 ms) is not put in de queue
>of the application but in a queue of the thread? The thread then only has
>WM_TIMER messages and no other messages so maybe I can guarantee the time of
>1 ms???
>
>Thank you,
>
>Johan Machielse
>

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm

0 new messages