Skip to content

Lazy handling of events #46

@evilnose

Description

@evilnose

Right now event handlers are called as soon as events are posted. This is undesirable for two reasons

  1. Function call stack may get too large and overflow, or there may be infinite loops in the future
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions