Skip to content

Accept an Io\Poll\Handle wherever a stream is taken - #1

Closed
nicolas-grekas wants to merge 1 commit into
masterfrom
io-poll-handle
Closed

nicolas-grekas wants to merge 1 commit into
masterfrom
io-poll-handle

Conversation

@nicolas-grekas

Copy link
Copy Markdown
Owner

Needs php/php-src#23810, which exports what an extension needs to recognise a handle.

PHP 8.6 adds Io\Poll\Handle, the object an extension hands out for something that can be waited on. php/frankenphp#2636 is the first to ship them, a background worker and the two sides of a task, and php_poll_handle_get_fd() turns any of them into a descriptor, so php_event_zval_to_fd() takes one next to the streams and sockets it already accepts:

$handle = new FrankenPHP\WorkerHandle();
$event = new Event($base, $handle, Event::READ | Event::PERSIST, function () use ($handle) {
    $handle->tick();
});
$event->add();

The extension builds unchanged on 8.6 otherwise, and make test stays at 28 passed, 0 failed with this.

Opened here because Bitbucket refuses a fork of the upstream repo ("Forking to a different workspace is not allowed") and its issue tracker now answers 410.

PHP 8.6 lets an extension hand out an Io\Poll\Handle for something that can be
waited on, and php_poll_handle_get_fd() turns any of them into a descriptor.
@nicolas-grekas

Copy link
Copy Markdown
Owner Author

Let me close: php-src would rather keep the handle API internal to Io\Poll for now (php/php-src#23810), and 8.7 is getting handle types with no descriptor at all, so what an extension should accept has to settle first. Worth revisiting then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant