Skip to content

Implement waker for UI events processing#227

Merged
AlixANNERAUD merged 3 commits into
mainfrom
216-improve-task-scheduling-2
May 13, 2026
Merged

Implement waker for UI events processing#227
AlixANNERAUD merged 3 commits into
mainfrom
216-improve-task-scheduling-2

Conversation

@AlixANNERAUD
Copy link
Copy Markdown
Contributor

@AlixANNERAUD AlixANNERAUD commented May 13, 2026

This pull request introduces improvements to the event handling and asynchronous behavior of the Window system, especially in the file_manager and settings executables. The main changes center around making event loops more responsive by removing fixed sleep intervals and implementing an async waker-based system for UI event processing. Additionally, the Window struct is extended to support async yielding, allowing tasks to efficiently wait for new UI events.

Event loop and async improvements:

  • Replaced the fixed task::sleep delay in the main event loops of file_manager and settings with an efficient, event-driven approach—now the loops simply await handle_events() without sleeping, improving responsiveness and reducing unnecessary wakeups. [1] [2]
  • Modified the handle_events method in both FileManager and Settings to use the new window.yield_now().await mechanism, which asynchronously yields until new events are available, instead of relying on polling and sleeping. [1] [2]

Window struct and event system enhancements:

  • Added a waker registration system to Window using an AtomicWaker, and updated event callbacks to wake any registered waker when new events arrive. This enables efficient async notification of UI events. [1] [2] [3] [4] [5]
  • Introduced the yield_now async method on Window, which returns a future that resolves when the next event is available, integrating seamlessly with async/await.

Minor codebase maintenance:

  • Added missing imports (poll_fn, log, etc.) and minor refactoring for clarity and future extensibility in settings.rs and related files. [1] [2]

These changes collectively make the UI event system more efficient and idiomatic for async Rust, improving both responsiveness and power efficiency.

@AlixANNERAUD AlixANNERAUD linked an issue May 13, 2026 that may be closed by this pull request
@AlixANNERAUD AlixANNERAUD changed the title 216 improve task scheduling 2 Implement waker for UI event processing May 13, 2026
@AlixANNERAUD AlixANNERAUD changed the title Implement waker for UI event processing Implement waker for UI events processing May 13, 2026
@AlixANNERAUD AlixANNERAUD enabled auto-merge (squash) May 13, 2026 13:45
@AlixANNERAUD AlixANNERAUD merged commit 70020e9 into main May 13, 2026
3 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve task scheduling

1 participant