Commit 19c3a58
committed
async: coroutine engine core, reference schedulers and the coroutine context
The Async Core ABI (zend_async_API.h): coroutines with a packed lifecycle,
scheduler slots (launch, enqueue-with-error, suspend, cancel, await),
switch/finish handler vectors, the awaiting-info vector, microtasks, and
the coroutine context — an embedded internal store for C extensions
(process-unique numeric keys) plus the userland zend_async_context_t
storage behind a provider-registered class. Fibers run as coroutines under
a scheduler; gc_collect_cycles() stays synchronous over a GC coroutine;
shutdown drains coroutines gracefully.
Two optional in-tree providers validate the ABI from both sides:
ext/test_scheduler, the C reference (gated by test_scheduler.enable), and
ext/async_scheduler_hook, the PHP bridge — Async\SchedulerHook +
Async\Scheduler (onLaunch/onShutdown/onFiber/onEnqueue/onSuspend/onDefer),
a coroutine-centric mandate of three hidden capabilities
(bindEntry/switchTo/currentCoroutine), explicit main replacement at every
end-of-main handover, and the Async\Context / Async\get_context() surface
over the engine storage.
Tests run both variants in one binary: upstream suites stay byte-for-byte
and run schedulerless; scheduler-adapted duplicates and the provider
suites opt in.1 parent 28dab5f commit 19c3a58
81 files changed
Lines changed: 7269 additions & 68 deletions
File tree
- Zend
- tests/fibers
- ext/test_scheduler
- tests
- main
- win32/build
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
831 | 832 | | |
832 | 833 | | |
833 | 834 | | |
| 835 | + | |
834 | 836 | | |
835 | 837 | | |
836 | 838 | | |
| |||
1979 | 1981 | | |
1980 | 1982 | | |
1981 | 1983 | | |
| 1984 | + | |
1982 | 1985 | | |
1983 | | - | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
1984 | 1991 | | |
1985 | 1992 | | |
1986 | 1993 | | |
| |||
0 commit comments