Skip to content

Commit e136ba2

Browse files
committed
#66: Add ZEND_ASYNC_SCHEDULER_LAUNCH() to TrueAsync public API
Expose async_scheduler_launch() function through the TrueAsync API to allow extensions to explicitly initialize and start the scheduler before creating coroutines. This is particularly useful for extensions that need deterministic scheduler initialization timing. Changes: - Add zend_async_scheduler_launch_t function pointer type - Add ZEND_ASYNC_SCHEDULER_LAUNCH() macro for scheduler initialization - Register scheduler_launch_fn as first parameter in zend_async_scheduler_register() - Update CHANGELOG.md with API addition in version 0.5.0
1 parent a7dff7c commit e136ba2

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [0.5.0] - 2025-10-31
99

10+
### Added
11+
- **TrueAsync API**: Added `ZEND_ASYNC_SCHEDULER_LAUNCH()` macro for scheduler initialization
12+
1013
### Changed
1114
- **Deadlock Detection**: Replaced warnings with structured exception handling
1215
- Deadlock detection now throws `Async\DeadlockError` exception instead of multiple warnings
13-
- **Breaking Change**: Applications relying on deadlock warnings
16+
- **Breaking Change**: Applications relying on deadlock warnings
1417
will need to be updated to catch `Async\DeadlockError` exceptions
1518

1619
## [0.4.0] - 2025-09-30

async_API.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,7 @@ void async_api_register(void)
11241124
{
11251125
zend_async_scheduler_register(PHP_ASYNC_NAME_VERSION,
11261126
false,
1127+
async_scheduler_launch,
11271128
async_new_coroutine,
11281129
async_new_scope,
11291130
(zend_async_new_context_t) async_context_new,

scheduler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ bool async_scheduler_launch(void)
747747
return false;
748748
}
749749

750-
if (EG(active_fiber)) {
750+
if (UNEXPECTED(EG(active_fiber))) {
751751
async_throw_error("The True Async Scheduler cannot be started from within a Fiber");
752752
return false;
753753
}

0 commit comments

Comments
 (0)