-
Notifications
You must be signed in to change notification settings - Fork 72
refactor(runtime): introduce Scheduler for task scheduling
#491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the task scheduling logic by extracting it into a dedicated Scheduler module. The changes centralize scheduling responsibilities, improve code organization, and remove scattered scheduling logic from the main runtime implementation.
Key changes:
- Introduced a new
Schedulerstruct that encapsulates task queue management and execution logic - Created
TaskQueueto manage both local and synchronized task queues - Moved scheduling logic from
Runtimeinto the dedicated scheduler module
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| compio-runtime/src/runtime/scheduler/mod.rs | Introduces the new Scheduler and TaskQueue types with task spawning and execution methods |
| compio-runtime/src/runtime/scheduler/local_queue.rs | Implements a thread-local queue wrapper (LocalQueue) for non-Sync interior mutability |
| compio-runtime/src/runtime/mod.rs | Refactors Runtime to use the new Scheduler, removing inline scheduling logic |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Berrysoft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'm not that sure about the usage of UnsafeCell. I request @George-Miao to review local_queue.rs.
George-Miao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. Just update the SAFETY note. Thanks for the PR!
b92604e to
acf39ec
Compare
acf39ec to
07682a1
Compare
This PR introduces the
schedulermodule, which encapsulates all task scheduling logic.