Stop Making that noice!

Started by
3 comments, last by H4ck3r 21 years, 4 months ago
Ive got a program, which uses: while(bRunning) { } But I don''t want this program to take that much processor speed. So how can I add a time out or something? That it wont take that much processor speed?
Advertisement
depends on what exactly code inside the loop does.

you''ll have to use one of the functions that pause thread execution until a certain event occurs, such as:

sleep
getmessage
waitforsingleobject

which to use, as i said, depends on your code.
Well, my code doesn''t have alot more than what ive said:
while(bRunning)
{

}

It''s not a thread. It uses one thread, but that''s just one thread with a messagebox, and then it stops.
I guess sleep is the best one for me but... Which file do I have to include?
Ok. Got it... 10x!
look it up on msdn.

if you''re using a thread and want to wait until something happens, use the event object (createevent) and waitforsingleobject.

This topic is closed to new replies.

Advertisement