Skip to content

Add EventsLoop::wakeup independent of interrupt #175

Closed

Description

@jwilm

The method EventsLoop::interrupt() is currently serving the dual purpose of

  1. Stop processing events during run_forever and poll_events
  2. Wakeup the event loop from other threads

Running the wakeup code when you only care about 1. simply wastes cycles.

I'm proposing that a second method, EventsLoop::wakeup() is added to allow performing these tasks independently. An alternative design would be removing the interrupted flag altogether and allow the closure passed to run_forever and poll_events to return a flag indicating their desire to continue or halt.

Activity

  1. jwilm commented on May 10, 2017

    @jwilm
    ContributorAuthor

    Btw, I'd be happy to implement this. I thought discussion was an appropriate first step, though.

  2. jwilm commented on May 11, 2017

    @jwilm
    ContributorAuthor

    I've thought about this a bit more, and I think it would be appropriate for the wakeup method to take a winit::WindowId so that the Awakened event is associated with the correct window.

  3. jwilm commented on May 11, 2017

    @jwilm
    ContributorAuthor

    Digging into the source a bit, it looks like there's some leftover WindowProxy implementations. These aren't available in the public API anymore since the recent event handling refactor. Seems like they should be removed / be absorbed into EventsLoop::wakeup implementations.

  4. jwilm commented on May 19, 2017

    @jwilm
    ContributorAuthor

    Does anyone have feedback about this?

  5. mitchmindtree commented on May 22, 2017

    @mitchmindtree
    Contributor

    @jwilm just thought I'd let you know that #136 and in particular this comment are related to (and probably supersede) this.

  6. jwilm commented on May 23, 2017

    @jwilm
    ContributorAuthor

    Agreed that the pending Proxy type should supersede this.

  7. added a commit that references this issue on Jan 5, 2022
  8. added a commit that references this issue on Jun 11, 2022
    eb05193
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions