• Advertisement

Archived

This topic is now archived and is closed to further replies.

Stop Making that noice!

This topic is 5557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement