mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Introduce Fiber#storage
for inheritable fiber-scoped variables. (#6612)
This commit is contained in:
parent
9869bd1d61
commit
0436f1e15a
Notes:
git
2022-12-01 10:00:52 +00:00
Merged-By: ioquatix <samuel@codeotaku.com>
10 changed files with 442 additions and 56 deletions
|
@ -766,7 +766,8 @@ next_init(VALUE obj, struct enumerator *e)
|
|||
{
|
||||
VALUE curr = rb_fiber_current();
|
||||
e->dst = curr;
|
||||
e->fib = rb_fiber_new(next_i, obj);
|
||||
// We inherit the fiber storage by reference, not by copy, by specifying Qfalse here.
|
||||
e->fib = rb_fiber_new_storage(next_i, obj, Qfalse);
|
||||
e->lookahead = Qundef;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue