rfc:fiber
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:fiber [2018/04/17 22:48] – lvht | rfc:fiber [2018/04/18 22:36] – lvht | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Version: 0.1 | * Version: 0.1 | ||
* Date: 2017-09-13 | * Date: 2017-09-13 | ||
- | * Author: Haitao Lv, i@lvht.net | + | * Author: Haitao Lv<i@lvht.net>, Dmitry Stogov< |
* Status: Under Discussion | * Status: Under Discussion | ||
* First Published at: http:// | * First Published at: http:// | ||
Line 16: | Line 16: | ||
===== Proposal ===== | ===== Proposal ===== | ||
==== Why not make it as a Extension? ==== | ==== Why not make it as a Extension? ==== | ||
- | Fibers | + | Fiber is a major language |
==== Implementation ==== | ==== Implementation ==== | ||
- | ===== Proposed API ===== | + | === Proposed API === |
<code php> | <code php> | ||
final class Fiber { | final class Fiber { | ||
Line 62: | Line 62: | ||
</ | </ | ||
- | Here is the usage demo, | + | === Usage Demo === |
<code php> | <code php> | ||
function sub1() | function sub1() | ||
Line 80: | Line 80: | ||
</ | </ | ||
- | ==== Implementation Detail ==== | + | === Implementation Detail === |
+ | In our simple implementation, | ||
+ | |||
+ | Backup/ | ||
+ | |||
+ | Martin Schröder is working on this at https:// | ||
+ | |||
+ | ^Property^Full stack Fiber^Zend stack Fiber^ | ||
+ | |Code Base|c & asm|c| | ||
+ | |Minimum Memory Usage|VM stack only (4 KB)|VM & C stack (4 KB + 4 KB)| | ||
+ | |Supported Architecturs|any platform|x86 at this time| | ||
+ | |Yield in Internal Function|unsupported|supported| | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 106: | Line 117: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
- | < | + | < |
- | </ | + | |
- | + | ||
- | Fiber does not support yielding during the internal call. Calling Fiber:: | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Offering methods | + | |
- | + | ||
- | < | + | |
- | + | ||
- | The Fiber:: | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Both Ruby's Fiber and Lua's coroutine using the **resume()** API to **init** and **resume** their coroutine. There is no need to offer a **dedicate init** API. | + | |
- | + | ||
- | < | + | |
- | You will get a Fatal Error like | + | And as a language feature, Fiber should only offer the essential API. User can implement these methods in user land code easily. |
- | Fatal error: Uncaught Error: Cannot call Fiber::yield out of Fiber | + | < |
- | < | + | Both Ruby's Fiber and Lua's coroutine using the same **resume()** API to **init** |
- | Introducing new keywords | + | < |
- | Both Ruby's Fiber and Lua's coroutine | + | Introducing new keywords will cause BC impact. |
===== Unaffected PHP Functionality ===== | ===== Unaffected PHP Functionality ===== |
rfc/fiber.txt · Last modified: 2018/06/12 07:40 by krakjoe