Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any intention to create a PHP RFC for a Fiber scheduler? #447

Open
EdmondDantes opened this issue Nov 24, 2024 · 3 comments
Open

Comments

@EdmondDantes
Copy link

Good day,

I would like to once again express my gratitude to all the developers of this project. Thanks to your code, I have learned a lot about implementing asynchronous programming. I really appreciate the efficient approach to creating fibers. It's awesome!

However, I am unpleasantly surprised by what is happening at the PHP language level.

PHP has fibers, and that was a significant change, but not sufficient.

For the language to fully support asynchronous programming, an API is needed.

An API is needed that would allow transferring control from the fiber context to the scheduler.

For example, let's assume the code uses a PHP function like socket read/write. At the moment of invocation, this function could determine whether it is being executed inside a fiber. If so, it immediately passes its I/O descriptor, additional options, and invokes the scheduler.

The Scheduler API then transfers control to code that decides how to proceed with context switching, which objects to wait for, and so on.

PHP already has a similar implementation at the Zend level—Swoole—which uses hooks to override the behavior of standard functions.

But why hasn’t this been standardized yet? Such an API would save time when creating libraries, avoiding the need to clone PDO and similar tools.

Thank you once again for your contribution.

@Bilge
Copy link
Contributor

Bilge commented Nov 24, 2024

Yes.

@EdmondDantes
Copy link
Author

Yes.

So, this RFC exists, but it’s not publicly available yet?

@Bilge
Copy link
Contributor

Bilge commented Nov 24, 2024 via email

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

No branches or pull requests

2 participants