summaryrefslogtreecommitdiff
path: root/prelude.rb
diff options
context:
space:
mode:
-rw-r--r--prelude.rb11
1 files changed, 5 insertions, 6 deletions
@@ -1,16 +1,15 @@
-class Thread
- MUTEX_FOR_THREAD_EXCLUSIVE = Thread::Mutex.new # :nodoc:
- private_constant :MUTEX_FOR_THREAD_EXCLUSIVE
-
# call-seq:
# Thread.exclusive { block } => obj
#
# 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(&block)
warn "Thread.exclusive is deprecated, use Thread::Mutex", caller
- MUTEX_FOR_THREAD_EXCLUSIVE.synchronize(&block)
end
end