refactor(runtime): introduce Scheduler for task scheduling#491
Conversation
There was a problem hiding this comment.
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.
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.
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.