1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use own mutex instead of Thread.exclusive

ref [Feature #17125]
This commit is contained in:
Kazuhiro NISHIYAMA 2020-08-27 14:34:42 +09:00
parent 5ae2c1b093
commit 3353baac3d
No known key found for this signature in database
GPG key ID: 262ED8DBB4222F7A

View file

@ -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