Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
16 lines (14 sloc) 0.448 kB
class Thread
MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new # :nodoc:
# 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
MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{
yield
}
end
end
Jump to Line
Something went wrong with that request. Please try again.