summaryrefslogtreecommitdiff
path: root/ractor.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-12-04 14:39:03 +0900
committerKoichi Sasada <ko1@atdot.net>2020-12-04 14:42:38 +0900
commit82bbce826f7f170270856bec8ef852667028d143 (patch)
treec49ee3a9e213e4a480437ef3d7caacaf68f16aba /ractor.c
parentf1757a88a4c8e2a50481de020787b37d926463df (diff)
fix index
`i` should not be used here because `i` will be `alen` when jumped here by "goto restart".
Diffstat (limited to 'ractor.c')
-rw-r--r--ractor.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ractor.c b/ractor.c
index f17a75bc3f..d7a9c85523 100644
--- a/ractor.c
+++ b/ractor.c
@@ -802,6 +802,7 @@ ractor_select(rb_execution_context_t *ec, const VALUE *rs, int alen, VALUE yield
bool interrupted = false;
enum ractor_wait_status wait_status = 0;
bool yield_p = (yielded_value != Qundef) ? true : false;
+ const int rs_len = alen;
struct ractor_select_action {
enum ractor_select_action_type {
@@ -840,8 +841,8 @@ ractor_select(rb_execution_context_t *ec, const VALUE *rs, int alen, VALUE yield
restart:
if (yield_p) {
- actions[i].type = ractor_select_action_yield;
- actions[i].v = Qundef;
+ actions[rs_len].type = ractor_select_action_yield;
+ actions[rs_len].v = Qundef;
wait_status |= wait_yielding;
alen++;