Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

changing WM_TIMER priority

Posted on 1997-10-17
3
Medium Priority
?
1,155 Views
Last Modified: 2013-11-20
How can i change message priority's in MFC, is it possible at all?
I don't know why, but WM_TIMER is a low priority message, the timer proc. is called after all other messages are handles.
I have tried already:
1) CWinApp::IsIdleMessage
2) SetWritableTmer as an alternative ( so stupid, the thread has to be in a wait/alertable stat - SleepEx )
3) timeSetEvent as an alternative - it's ok, but i would realy want to change that WM_TIMER priority - no semaphores needed + i already finished a whole lot of code writing, based on WM_TIMER...
thanx  :-o
0
Comment
Question by:shaig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Author Comment

by:shaig
ID: 1308270
Edited text of question
0
 
LVL 3

Accepted Solution

by:
Melange earned 200 total points
ID: 1308271
The WM_TIMER message has never been guaranteed to be an exact accurate measurement of time. It is only a notification that at LEAST the required interval has passed. For example, if you have a timer for 1 second intervals and then decide to do a thread eating 5 second process you will NOT receive 5 different timer messages when you resume processing messages. You will only get 1.

The way WM_TIMER works is that when the interval has passed, Windows sets a flag in your message queue. When the last message is processed in your queue, Windows checks this flag and then decides that it should either send you a WM_TIMER or call your TimerProc (depends on how you used the SetTimer call).

If you truly need something that is near 100% accurate on time intervals, then you will need to use something else, preferably a second thread that does the time critical process.

0
 
LVL 3

Author Comment

by:shaig
ID: 1308272
The stuff about "eating cpu for 5 seconds..." is obvious, but why the hell is this message handled last?
Is there such a thing called a "message priority"?
Is the source code of the section you descried available anyware?
Since the timer event has to be processed by one praticular thread, another thread won't help because it will have to wait for the first one to have time for it anyway ( event's pass only when a thread is in that stupid alertable wait stat ).
Is there a way to signal  ( interrupt ) a thread without having it put to sleep ( or to SleepEx if to be exact ) ?
thank you very much for responding, sorry for beeing such a pian  in the butt, oh... and sorry for my poor english.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question