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