Skip to content

Grouped events #362

Description

@olofson

Inspired by a gamedev problem I'm currently working on, I realize that it would be useful to declare events as related, so they can be managed in a way similar to database transactions. More specifically;

  • Late events can be handled on a group bases, in a configurable manner:
    • Handle late events ASAP, disregarding groups (current behavior)
    • Delay the whole group, preserving relative timing
    • Cancel the whole group
  • If we implement cancel, update, repeat or similar operations on pending events, we can have those operations apply to whole groups, database transaction style, guaranteeing that an operation will either be performed in full on all events in the group, or the whole operation is cancelled or unrolled.

Since interface contexts can be considered stateful (current interfaces are created per thread, and a thread-safe implementation would rely on TLS, to the same effect), we can implement groups by adding methods along the lines of BeginGroup()/EndGroup(), where BeginGroup() switches event enqueuing to a local buffer, and EndGroup() finalizes and sends the group via a single event to the engine context. Thus, API can remain simple to use, with virtually no impact on synchronization, performance etc when using event grouping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementMinor features, and improvements on existing functionalityfeatureEntirely new featuresmultitdreadingIssues related to distributing work across CPU threads

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions