Jump to content
  • Advertisement
Sign in to follow this  
GosuDrew

Threads

This topic is 4681 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

I'm working with Cplusplus/windows btw. When the main window of my application is dragged, the timer code does not get executed at least once per second.
while (1)
{
   if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
   {
      if (msg.message == WM_QUIT)
         break;

      TranslateMessage (&msg);
      DispatchMessage (&msg);
   }
   else
   {
      //update player's times
      //...

      //check sockets for data
      //...
   }
}
My question is: To make sure that my timer code and maybe even network code get executed at least once per second, should I use threads?

Share this post


Link to post
Share on other sites
Advertisement
You know, I remember wanting to do this once.. and I came to the conclusion that it can't be avoided by any normal means, and I never found how to get around it.
Every windowed app I notice (like Quake, Quake2, etc) will entirely freeze when dragging the window. Threads won't help, Windows seems to lock the entire window when it's happening, so if you try to draw to it doesn't work either.

It might be different on newer windows though. Win2000/Win98 I never made it work.


Share this post


Link to post
Share on other sites
I'm using windowsXP. If threads will not guarantee that the code at least executes once per second, the only other way I can think of is catching the message and doing nothing with it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!