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