From 05d4ee86308226ba5ffcd90247c6c60bf2347b6b Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 25 Dec 2017 03:25:45 +0000 Subject: prelude.rb: block passing * prelude.rb (Thread.exclusive): pass the block as a block argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- prelude.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'prelude.rb') diff --git a/prelude.rb b/prelude.rb index 27d54d1740..7cfe0892b3 100644 --- a/prelude.rb +++ b/prelude.rb @@ -8,11 +8,9 @@ class Thread # Wraps the block in a single, VM-global Mutex.synchronize, returning the # value of the block. A thread executing inside the exclusive section will # only block other threads which also use the Thread.exclusive mechanism. - def self.exclusive + def self.exclusive(&block) warn "Thread.exclusive is deprecated, use Thread::Mutex", caller - MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{ - yield - } + MUTEX_FOR_THREAD_EXCLUSIVE.synchronize(&block) end end -- cgit v1.2.3