summaryrefslogtreecommitdiff
path: root/sample/drb
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2020-08-27 14:34:42 +0900
committerKazuhiro NISHIYAMA <zn@mbf.nifty.com>2020-08-27 14:37:03 +0900
commit3353baac3d55e1b42515ce7084e7b7f07abc0192 (patch)
tree34ca6364cd59ae370f78e5e957443f91acc13818 /sample/drb
parent5ae2c1b093cbd2b9f72cb5caba19283a8222b298 (diff)
Use own mutex instead of Thread.exclusive
ref [Feature #17125]
Diffstat (limited to 'sample/drb')
-rw-r--r--sample/drb/name.rb3
1 files changed, 2 insertions, 1 deletions
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'
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