Skip to content

Zend async Scheduler ABI#22561

Draft
EdmondDantes wants to merge 1 commit into
php:masterfrom
true-async:async-core
Draft

Zend async Scheduler ABI#22561
EdmondDantes wants to merge 1 commit into
php:masterfrom
true-async:async-core

Conversation

@EdmondDantes

@EdmondDantes EdmondDantes commented Jul 2, 2026

Copy link
Copy Markdown

A lightweight asynchronous core without complex logic.

The idea is:
https://github.com/true-async/php-async-core-rfc/blob/main/scheduler_rfc.md

A detailed explanation of the core integration can be found here:
https://github.com/true-async/php-async-core-rfc/blob/main/core-integration.md

At the moment, both the code and the RFC are still under development. I'd be happy to hear your ideas and feedback.

@EdmondDantes
EdmondDantes marked this pull request as draft July 2, 2026 17:48
@EdmondDantes
EdmondDantes force-pushed the async-core branch 4 times, most recently from 615d050 to ed9fe03 Compare July 2, 2026 18:11
@EdmondDantes
EdmondDantes force-pushed the async-core branch 10 times, most recently from f3b272d to 6e1a5ce Compare July 3, 2026 09:58
Comment thread Zend/zend_async_API.c Outdated
Comment thread Zend/zend_scheduler_hook.stub.php Outdated
Comment thread Zend/zend_gc.c Outdated
Comment thread Zend/zend_scheduler_hook.stub.php Outdated
@EdmondDantes
EdmondDantes force-pushed the async-core branch 2 times, most recently from 4f08e57 to 55fafc8 Compare July 16, 2026 10:04
@EdmondDantes EdmondDantes changed the title Async core Zend async Scheduler ABI Jul 16, 2026
@EdmondDantes
EdmondDantes force-pushed the async-core branch 2 times, most recently from 88382e3 to 5369211 Compare July 18, 2026 08:39
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants