2018-01-06 22:10:00 -05:00
|
|
|
class << Thread
|
2010-03-29 08:48:43 -04:00
|
|
|
# call-seq:
|
2019-05-04 09:31:21 -04:00
|
|
|
# Thread.exclusive { block } -> obj
|
2011-05-15 07:55:52 -04:00
|
|
|
#
|
2014-04-17 03:31:43 -04:00
|
|
|
# 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.
|
2018-01-06 22:10:00 -05:00
|
|
|
def exclusive(&block) end if false
|
|
|
|
mutex = Mutex.new # :nodoc:
|
|
|
|
define_method(:exclusive) do |&block|
|
2019-10-12 00:25:52 -04:00
|
|
|
warn "Thread.exclusive is deprecated, use Thread::Mutex", uplevel: 1
|
2018-01-06 22:10:00 -05:00
|
|
|
mutex.synchronize(&block)
|
2007-08-24 21:09:08 -04:00
|
|
|
end
|
|
|
|
end
|
2015-11-11 21:00:41 -05:00
|
|
|
|
2017-01-05 22:11:45 -05:00
|
|
|
class Binding
|
2018-10-26 13:08:30 -04:00
|
|
|
# :nodoc:
|
2017-01-05 22:11:45 -05:00
|
|
|
def irb
|
|
|
|
require 'irb'
|
|
|
|
irb
|
|
|
|
end
|
2017-11-30 22:54:49 -05:00
|
|
|
|
|
|
|
# suppress redefinition warning
|
|
|
|
alias irb irb # :nodoc:
|
2017-01-05 22:11:45 -05:00
|
|
|
end
|
2017-11-29 20:31:00 -05:00
|
|
|
|
|
|
|
module Kernel
|
|
|
|
def pp(*objs)
|
|
|
|
require 'pp'
|
2017-11-29 21:12:42 -05:00
|
|
|
pp(*objs)
|
2017-11-29 20:31:00 -05:00
|
|
|
end
|
2017-11-30 22:54:49 -05:00
|
|
|
|
|
|
|
# suppress redefinition warning
|
|
|
|
alias pp pp # :nodoc:
|
2018-10-10 21:03:05 -04:00
|
|
|
|
|
|
|
private :pp
|
2017-11-29 20:31:00 -05:00
|
|
|
end
|