mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mrb_env_unshare() to break the link to fiber
Currently `e->cxt` is used exclusively to check for `break` / `return` availability. In other words, there is no need to maintain a reference to a fiber that has reached its end.
This commit is contained in:
@@ -387,6 +387,8 @@ mrb_env_unshare(mrb_state *mrb, struct REnv *e, mrb_bool noraise)
|
||||
if (e->cxt != mrb->c) return TRUE;
|
||||
if (e == CI_ENV(mrb->c->cibase)) return TRUE; /* for mirb */
|
||||
|
||||
e->cxt = NULL; /* make possible to GC the fiber that generated the env */
|
||||
|
||||
size_t len = (size_t)MRB_ENV_LEN(e);
|
||||
if (len == 0) {
|
||||
e->stack = NULL;
|
||||
|
||||
Reference in New Issue
Block a user