ruby-changes:59935
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Thu, 6 Feb 2020 11:47:21 +0900 (JST)
Subject: [ruby-changes:59935] 34f8e75f93 (master): rb_vm_t::postponed_job_index shall be rb_atomic_t
https://git.ruby-lang.org/ruby.git/commit/?id=34f8e75f93 From 34f8e75f9305b0da4ef1b0d4fe9ea3c3f31dcc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Fri, 31 Jan 2020 16:15:28 +0900 Subject: rb_vm_t::postponed_job_index shall be rb_atomic_t Pointer to this field is passed to ATOMIC_CAS. We have to use rb_atomic_t for that purpose. diff --git a/vm_core.h b/vm_core.h index a2f6af3..d0676ae 100644 --- a/vm_core.h +++ b/vm_core.h @@ -642,7 +642,7 @@ typedef struct rb_vm_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L642 /* postponed_job (async-signal-safe, NOT thread-safe) */ struct rb_postponed_job_struct *postponed_job_buffer; - int postponed_job_index; + rb_atomic_t postponed_job_index; int src_encoding_index; diff --git a/vm_trace.c b/vm_trace.c index e72c618..f1aa35d 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -1559,7 +1559,7 @@ enum postponed_job_register_result { https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1559 /* Async-signal-safe */ static enum postponed_job_register_result postponed_job_register(rb_execution_context_t *ec, rb_vm_t *vm, - unsigned int flags, rb_postponed_job_func_t func, void *data, int max, int expected_index) + unsigned int flags, rb_postponed_job_func_t func, void *data, rb_atomic_t max, rb_atomic_t expected_index) { rb_postponed_job_t *pjob; @@ -1610,7 +1610,7 @@ rb_postponed_job_register_one(unsigned int flags, rb_postponed_job_func_t func, https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1610 rb_execution_context_t *ec = GET_EC(); rb_vm_t *vm = rb_ec_vm_ptr(ec); rb_postponed_job_t *pjob; - int i, index; + rb_atomic_t i, index; begin: index = vm->postponed_job_index; @@ -1673,7 +1673,7 @@ rb_postponed_job_flush(rb_vm_t *vm) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1673 { EC_PUSH_TAG(ec); if (EC_EXEC_TAG() == TAG_NONE) { - int index; + rb_atomic_t index; struct rb_workqueue_job *wq_job; while ((index = vm->postponed_job_index) > 0) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/