by mm40 » Mar 12, 2003 @ 6:14pm
The code I posted is what my original app looked like. For the GapiDraw one I did place my draw() function inside ProcessNextFrame. You still need critical sections protecting it because in my code above WinProc and draw are guarenteed to not be called at the same time, because the loop is either drawing or posting messages.
But in GapiDrawApplication there is another thread that is created, so WinProc and ProcessNextFrame (which includes my draw) can be called at the same time. This is why my app was crashing, I expect and require that WinProc and ProcessNextFrame be called separate, this is why I need critical sections.
Your suggestions of posting input and handling it later would work fine, it is just a little easier to add 5 lines of code for critical sections, than queing and dequing another message buffer on top of the windows message buffer.