You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements priority-based coroutine scheduling where higher priority values
result in coroutines being queued at the front of the execution queue.
## Changes
### Circular Buffer Enhancement
- Add `circular_buffer_push_front()` function to insert elements at buffer head
- Fallback to normal push when front insertion is not possible (buffer full)
### API Extension
- Update `zend_async_spawn_t` typedef to include `int32_t priority` parameter
- Add new macros:
- `ZEND_ASYNC_SPAWN_WITH_PRIORITY(priority)`
- `ZEND_ASYNC_SPAWN_WITH_SCOPE_EX(scope, priority)`
- Maintain backward compatibility by updating existing macros to pass priority=0
### Priority Logic
- Priority > 0: coroutine queued at front (high priority)
- Priority ≤ 0: coroutine queued at back (normal/low priority)
- Preserves existing behavior for all current code
### Files Modified
- `ext/async/internal/circular_buffer.{h,c}` - Buffer front insertion
- `Zend/zend_async_API.{h,c}` - API definitions and stub functions
- `ext/async/async_API.c` - Priority-aware spawn implementation
## Backward Compatibility
All existing spawn macros unchanged in behavior, new priority parameter
defaults to 0 for normal scheduling order.
0 commit comments