Process/Thread Priority Findings

BlitzMax Forums/BlitzMax Programming/Process/Thread Priority Findings

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Budman: Delphi is my day job too, since 1996! Although I'm doing much more games programming these days in Blitz.

Anyway thanks very much for the code snippet, I get how that works, and didn't want to user Timers anyway. The thing is that isn't the app still consuming 100% CPU time because when PeekEvent is false, the function exits and the main while loop still goes round and round at full speed. This may defeat the point of letting other threads get their little time slice. Although I haven't tested it on this other person's PC yet (it will take a bit of integrating).

In fact I tested it full-screen and in windowed mode and checked out the CPU use in Task Manager (it was 50% in full-screen mode (I have a HT P4) and 20% in windowed mode), then I altered the code so that the main While loop says While not KeyDown(ESCAPE) instead (i.e. no even-based polling) and the CPU use is the same, it doesn't get worse. So is the event-based stuff giving the OS any more time? I'm not sure it is...

When I originally mentioned event-based games, I was imagining the use of WaitEvent so that when no events are happening the game is completely idle and the OS has all the CPU time it wants. However, I knew that to keep scrolling going an event would need to be generated fairly regularly and a timer might do that, or even a hook to VSync. So I'm still a bit