summaryrefslogtreecommitdiff
path: root/prelude.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-25 03:25:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-25 03:25:45 +0000
commit05d4ee86308226ba5ffcd90247c6c60bf2347b6b (patch)
tree12aa14a2c7e9cb6814f33de6219be9f5255c2ffb /prelude.rb
parent1ef15578960b5ff62f2bb7299a0dce50352a2741 (diff)
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
Diffstat (limited to 'prelude.rb')
-rw-r--r--prelude.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/prelude.rb b/prelude.rb
index 27d54d1..7cfe089 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