Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer

Status
Not open for further replies.

Berras

Programmer
Feb 24, 2002
42
0
0
GB
I have put a timer into my program using the SetTimer function, but when I run it the program takes up a lot of the cpu and takes a long time to shutdown.
Does anyone know a reason for this and how to overcome it?

Thanks.
Berras
 
What did you put in timer function?
Timer is like any other message-response function, so if timer interval is short and there is a significant work in timer-fn, that might be the problem, since your app won't process other messages on time
 
I think you should do like this

int the timer proc

if(isTimerWorking)return;
isTimerWorking = true;
...do enything there
isTimerWorking = false;

and somewhere s static or global variable
bool isTimerWorking = false;

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top