Implement waker for UI events processing#227
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces improvements to the event handling and asynchronous behavior of the
Windowsystem, especially in thefile_managerandsettingsexecutables. 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, theWindowstruct is extended to support async yielding, allowing tasks to efficiently wait for new UI events.Event loop and async improvements:
task::sleepdelay in the main event loops offile_managerandsettingswith an efficient, event-driven approach—now the loops simply awaithandle_events()without sleeping, improving responsiveness and reducing unnecessary wakeups. [1] [2]handle_eventsmethod in bothFileManagerandSettingsto use the newwindow.yield_now().awaitmechanism, which asynchronously yields until new events are available, instead of relying on polling and sleeping. [1] [2]Window struct and event system enhancements:
Windowusing anAtomicWaker, 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]yield_nowasync method onWindow, which returns a future that resolves when the next event is available, integrating seamlessly with async/await.Minor codebase maintenance:
poll_fn,log, etc.) and minor refactoring for clarity and future extensibility insettings.rsand 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.