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

ruby-changes:62715

From: Kazuhiro <ko1@a...>
Date: Thu, 27 Aug 2020 14:37:26 +0900 (JST)
Subject: [ruby-changes:62715] 3353baac3d (master): Use own mutex instead of Thread.exclusive

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

From 3353baac3d55e1b42515ce7084e7b7f07abc0192 Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Thu, 27 Aug 2020 14:34:42 +0900
Subject: Use own mutex instead of Thread.exclusive

ref [Feature #17125]

diff --git a/sample/drb/name.rb b/sample/drb/name.rb
index a8ad287..6d88186 100644
--- a/sample/drb/name.rb
+++ b/sample/drb/name.rb
@@ -39,11 +39,12 @@ require 'drb/drb' https://github.com/ruby/ruby/blob/trunk/sample/drb/name.rb#L39
 
 module DRbNamedObject
   DRbNAMEDICT = {}
+  DRBNAMEMUTEX = Thread::Mutex.new
   attr_reader(:drb_name)
 
   def drb_name=(name)
     @drb_name = name
-    Thread.exclusive do
+    DRBNAMEMUTEX.synchronize do
       raise(IndexError, name) if DRbNAMEDICT[name]
       DRbNAMEDICT[name] = self
     end
-- 
cgit v0.10.2


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

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