Repository navigation
Add waiting_io and waiting_sync states to differentiate wait types - #60
Conversation
Split the generic .waiting state into two distinct states: - .waiting_io: for I/O operations (xev completions, timers) - .waiting_sync: for synchronization primitives (mutexes, conditions, channels) This distinction enables future work stealing for tasks blocked on synchronization while keeping I/O-bound tasks pinned to their executor. It also makes the code more explicit about what type of waiting is happening. Updated timedWaitForReady to accept desired_state parameter for flexibility.
WalkthroughThe coroutine state machine is refactored to distinguish between I/O and synchronization waits. The generic Changes
Sequence DiagramsequenceDiagram
participant Coroutine
participant Executor
participant SyncPrimitive as Sync Primitive<br/>(Mutex/Condition/ResetEvent)
Note over Coroutine,Executor: Old Flow: Generic Waiting State
Coroutine->>SyncPrimitive: acquire/wait
SyncPrimitive->>Executor: yield(waiting)
Executor->>Coroutine: suspend
Note over Coroutine,Executor: New Flow: Refined States
Coroutine->>SyncPrimitive: acquire/wait
SyncPrimitive->>Executor: yield(waiting_sync, desired_state=waiting_sync)
Executor->>Coroutine: suspend with refined state
Note over Executor: Separate I/O operations
Coroutine->>Executor: waitForXevCompletion
Executor->>Coroutine: yield(waiting_io, desired_state=waiting_io)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes The changes involve coordinated updates to a core state machine enum, multiple affected runtime APIs with new parameters, and consistent (but semantically important) state transitions across synchronization primitives. While the pattern is repetitive, the logic density of state handling and careful coordination between runtime and sync modules demands careful verification. Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-10-15T19:38:44.659ZApplied to files:
🔇 Additional comments (12)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Split the generic .waiting state into two distinct states:
This distinction enables future work stealing for tasks blocked on synchronization while keeping I/O-bound tasks pinned to their executor. It also makes the code more explicit about what type of waiting is happening.
Updated timedWaitForReady to accept desired_state parameter for flexibility.
Summary by CodeRabbit