Right now event handlers are called as soon as events are posted. This is undesirable for two reasons
- Function call stack may get too large and overflow, or there may be infinite loops in the future
- The timing may not be well-balanced, since the main loop may spend too much time on a heavily-handled event
Lazy event handling may mitigate these issues. To implement that, when post_event() is called, the event is pushed into a queue. The queue is popped in some time interval (e.g. in OnIdle()) and events are handled then. I'm not sure yet whether the queue should be emptied each time, or perhaps events should stop being popped once a certain time limit has been reached.
This is not urgent since right now the app seems to run smoothly enough. Also, implementing this well may be difficult.
Right now event handlers are called as soon as events are posted. This is undesirable for two reasons
Lazy event handling may mitigate these issues. To implement that, when
post_event()is called, the event is pushed into a queue. The queue is popped in some time interval (e.g. inOnIdle()) and events are handled then. I'm not sure yet whether the queue should be emptied each time, or perhaps events should stop being popped once a certain time limit has been reached.This is not urgent since right now the app seems to run smoothly enough. Also, implementing this well may be difficult.