rfc:fibers
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:fibers [2021/03/08 18:09] – Update intro kelunik | rfc:fibers [2021/03/11 23:32] – Add note about future internal fiber API trowski | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2021-03-08 | * Date: 2021-03-08 | ||
* Authors: Aaron Piotrowski < | * Authors: Aaron Piotrowski < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 27: | Line 27: | ||
* Adding a '' | * Adding a '' | ||
* Adding exception classes '' | * Adding exception classes '' | ||
+ | |||
+ | Fibers allow for transparent non-blocking I/O implementations of existing interfaces (such as PSR-7, Doctine ORM, etc.). This is because the placeholder (promise) object is eliminated. Functions instead can declare the I/O result type instead of a placeholder object which cannot specify a resolution type because PHP does not support generics. | ||
==== Fibers ==== | ==== Fibers ==== | ||
Line 220: | Line 222: | ||
=== Fiber Stacks === | === Fiber Stacks === | ||
- | Each fiber is allocated a separate C stack and VM stack on the heap. The C stack is allocated using '' | + | Each fiber is allocated a separate C stack and VM stack on the heap. The C stack is allocated using '' |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Declares '' | Declares '' | ||
- | |||
- | ===== Proposed PHP Version(s) ===== | ||
- | |||
- | PHP 8.1 | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | === suspend keyword === | + | The current implementation does not provide an internal API for fibers for PHP extensions. This RFC focuses on the user space fiber API. An internal fiber API will be added, collaborating with other internal developers and using feedback from PHP extension developers, including Swoole, so fibers can be created and controlled from PHP extensions. An extension may still optionally provide their own custom fiber implementation, |
- | '' | + | ===== Proposed PHP Version(s) ===== |
- | // | + | PHP 8.1 |
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
Line 566: | Line 564: | ||
It is the opinion of the authors of this RFC that it is best to provide the bare minimum in core and allow user code to implement other components as they desire. If the community moves toward a single event loop API or a need emerges for an event loop in PHP core, this can be done in a future RFC. Providing a core event loop without core functionality using it (such as streams, file access, etc.) would be misleading and confusing for users. Deferring such functionality to user frameworks and providing only a minimum API in core keeps expectations in check. | It is the opinion of the authors of this RFC that it is best to provide the bare minimum in core and allow user code to implement other components as they desire. If the community moves toward a single event loop API or a need emerges for an event loop in PHP core, this can be done in a future RFC. Providing a core event loop without core functionality using it (such as streams, file access, etc.) would be misleading and confusing for users. Deferring such functionality to user frameworks and providing only a minimum API in core keeps expectations in check. | ||
- | This RFC does not preclude adding async/await and an event loop to core, see [[# | + | This RFC does not preclude adding async/await and an event loop to core. |
=== How does this proposal differ from prior Fiber proposals? === | === How does this proposal differ from prior Fiber proposals? === | ||
Line 583: | Line 581: | ||
As noted in [[# | As noted in [[# | ||
+ | |||
+ | ===== Vote ===== | ||
+ | |||
+ | Voting started on 2021-03-08 and will run through 2021-03-22. 2/3 required to accept. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== References ===== | ===== References ===== |
rfc/fibers.txt · Last modified: 2021/07/12 21:30 by kelunik