CC: Tweaked

CC: Tweaked

65M Downloads

Add an indicator for when the computer's event queue overflows.

fatboychummy opened this issue ยท 2 comments

commented

Currently, there is no way to see the length of the event queue, but it's still limited to 256! When trying to write parallel programs, it gets to be a bit of a pain because if you do go over that limit, there's no real indicator other than potentially one of your functions stalling. But, it could also be any other number of bugs too, so you sit there debugging for hours before realizing you overflowed the event queue (or the other way around, you debug why you're overflowing the event queue for hours before realizing it was some other bug instead).

A small LED on the edge of the screen somewhere that'd flick on for a half second or so whenever an event is discarded because the queue overflowed would be an incredible nice-to-have.

Potentially also (or alternatively) a lua function, something like os.hasEventQueueOverflowed() (working name), which would just return true if the event queue overflowed since the last time the function was called, false otherwise. This would allow us to add tests for these types of programs to ensure the event queue does not overflow.

commented

Alternatively, could we get the current length of the queue? If a system is queuing events via code, then it could slow itself down if the event queue gets full to keep space for world-triggered events.