Skip to content

Commit

Permalink
fix index
Browse files Browse the repository at this point in the history
`i` should not be used here because `i` will be `alen` when
jumped here by "goto restart".
  • Loading branch information
ko1 committed Dec 4, 2020
1 parent f1757a8 commit 82bbce8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ractor.c
Expand Up @@ -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 {
Expand Down Expand Up @@ -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++;

Expand Down

0 comments on commit 82bbce8

Please sign in to comment.