mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
1ef1557896
commit
05d4ee8630
1 changed files with 2 additions and 4 deletions
|
@ -8,11 +8,9 @@ class Thread
|
||||||
# Wraps the block in a single, VM-global Mutex.synchronize, returning the
|
# Wraps the block in a single, VM-global Mutex.synchronize, returning the
|
||||||
# value of the block. A thread executing inside the exclusive section will
|
# value of the block. A thread executing inside the exclusive section will
|
||||||
# only block other threads which also use the Thread.exclusive mechanism.
|
# 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
|
warn "Thread.exclusive is deprecated, use Thread::Mutex", caller
|
||||||
MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{
|
MUTEX_FOR_THREAD_EXCLUSIVE.synchronize(&block)
|
||||||
yield
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue