|
From: Mike A. <mi...@mi...> - 2005-07-17 20:49:54
|
Richard Rauch wrote: >On Sat, Jul 16, 2005 at 01:30:01PM -0700, Mike Austin wrote: > [...] > > >>This is my first post if you are wondering - I am working in Io >>(www.iolanguage.com) and Jeff (jptdrake) has moved glut to freeglut, so >>I joined to make a few suggestions. My original suggestion which I >>assume didn't make it to the list was to insert a Sleep() function for >>Windows into fgSleepForEvents(). Freeglut takes 100% cpu while doing >>nothing without it. I originally used "MsgWaitForMultipleObjects( ..., >> >> > >I thought that MsgWait*() would work... Are you saying that it doesn't work? > >Or is that not (or no longer) used in freeglut? > > >A short unconditional wait is not really as good, I think: > > * It does waste some CPU time, even if only a very little bit, to > wake up when there's nothing to do. This is the common case. > > * If a window system event arrives after the event processing > loop runs, it is bad to ignore it and go to sleep...though > a sufficiently short sleep may not be too harmful. > >If MsgWait*() works, I'd suggest staying with that. > To my knowledge there was no sleep or wait call in fgSleepForEvents(), so I first added a MsgWait(). The timeout needed to be the smallest possible, so the call was not any more efficient than plain Sleep(), especially since vertical sync is going to make your app wait anyway. Well, I guess it depends on how your app is written. Mike |