[前][次][番号順一覧][スレッド一覧]

ruby-changes:63891

From: Koichi <ko1@a...>
Date: Fri, 4 Dec 2020 14:43:05 +0900 (JST)
Subject: [ruby-changes:63891] 82bbce826f (master): fix index

https://git.ruby-lang.org/ruby.git/commit/?id=82bbce826f

From 82bbce826f7f170270856bec8ef852667028d143 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Fri, 4 Dec 2020 14:39:03 +0900
Subject: fix index

`i` should not be used here because `i` will be `alen` when
jumped here by "goto restart".

diff --git a/ractor.c b/ractor.c
index f17a75b..d7a9c85 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 https://github.com/ruby/ruby/blob/trunk/ractor.c#L802
     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 https://github.com/ruby/ruby/blob/trunk/ractor.c#L841
   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++;
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]