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

ruby-changes:58322

From: Koichi <ko1@a...>
Date: Sun, 20 Oct 2019 14:26:23 +0900 (JST)
Subject: [ruby-changes:58322] a0a3c70181 (master): delegate synchronize method

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

From a0a3c701816c2fe4ab6e940c6cf5638756ceb6dc Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Sun, 20 Oct 2019 14:21:04 +0900
Subject: delegate synchronize method

Delegate MonitorMixin#synchronize body to Monitor#synchronize.
It makes guarantee interrupt safe (because Monitor#synchronize is
written in C). I thought Ruby implementation is also safe, but I
got stuck failure <http://ci.rvm.jp/results/trunk_test@P895/2327639>
so that I introduce this fix to guarantee interrupt safe.

diff --git a/ext/monitor/lib/monitor.rb b/ext/monitor/lib/monitor.rb
index dba942c..f6b3023 100644
--- a/ext/monitor/lib/monitor.rb
+++ b/ext/monitor/lib/monitor.rb
@@ -205,12 +205,7 @@ module MonitorMixin https://github.com/ruby/ruby/blob/trunk/ext/monitor/lib/monitor.rb#L205
   # +MonitorMixin+.
   #
   def mon_synchronize(&b)
-    @mon_data.enter
-    begin
-      yield
-    ensure
-      @mon_data.exit
-    end
+    @mon_data.synchronize(&b)
   end
   alias synchronize mon_synchronize
 
-- 
cgit v0.10.2


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

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