Synchronous Platform Event Handling/Polling

Reporter: RobertBColton  |  Status: open  |  Last Modified: June 29, 2020, 01:31:42 PM

I'll just note here that in GM8.1 io_handle hogs 100% CPU while keyboard_wait and mouse_wait do not. ENIGMA behaves exactly the same. I just want to mention the reason why ENIGMA doesn't hog CPU is because we have a sleep in those loops.

It's possible the GM keyboard/mouse wait functions are using GetMessage instead of PeekMessage which possibly sleeps for us. For SDL it looks like SDL_WaitEvent is equivalent to GetMessage here.
https://stackoverflow.com/a/11065634

So basically ENIGMA can just provide a synchronous version of handleEvents for these types of generalized functions.

RobertBColton  
@time-killer-games I need you to test something. I want you to test what kind of CPU usage execute_shell has in GM when executing a long running process. Because of #2055 I have discovered that PeekMessage will create a loop with much higher CPU usage than GetMessage does because the latter uses waiting.
time-killer-games  

execute_shell doesn't wait; I assume you mean execute_program?
RobertBColton  

Oh, then yes.
time-killer-games  

Doing it now. In the meantime, could you tell me if you still need that dll stuff tested?

I'll just leave it running indefintirly with nothing else running but a browser, and see if the cpu raises checking here and there for the next hour or so while I'm doing stuff on a different computer.

RobertBColton  

Not right away but it's useful information when we get back to fixing platform state stuff. I'm doing mostly input right now so it can wait.
time-killer-games  

CPU seems to be stuck solid at 00 in task manager for the game and the executable that it launched, although i doubt the executable launched will be relevent, I'm checking that too.
RobertBColton  

See what ENIGMA is too please, with that MsgWaitForMultipleObjects change we did it should be near 0% CPU too. Also interesting to see if you could try reverting that change we did, I bet it will make it use the CPU because it didn't sleep.

Anyway, that's great, this is all confirming the decisions we've made thus far have been correct.

time-killer-games  

Capture

Doing enigma now. Interesting, GameMaker did this because I left it waiting for notepad to close for too long.

time-killer-games  

@RobertBColton master is at zero CPU as well
RobertBColton  

Good then yeah, everything we've done seems to have been correct. Now see what it was before we did those execute_program fixes, I guess it will be wonky or high CPU, but it might not be.
time-killer-games  

@RobertBColton i would say this in private, but you gave me no other means to contact you since you have me blocked everywhere else, but do you know why Josh is and has been ignoring the bloody shit out of me for months? He has responded to you and even talking about me in my plain viewing obnoxiously, but never once did he care to respond to me at all.
RobertBColton  

I don't want to keep going on about this, so I'll answer it one time. He's doing it to everybody afaict don't take it personal. Also there's a coronavirus going on, he has work and a social life, and yesterday he ignored me to work on JDI which I take his word for. Please don't keep getting hung up on interactions with other people, it's not good for anybody, you're doing fine and me and you are getting excellent things done.
time-killer-games  

Ok, thank you for the clarification. I understand, he did say he was overwhelmed and I get overwhelmed by rather small things and he has a lot more to worry about and take care of so it makes sense.
Please sign in to post comments, or you can view this issue on GitHub.