1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/prelude.rb
Koichi Sasada 365557f111 Define IO#read/write_nonblock with builtins.
IO#read/write_nonblock methods are defined in prelude.rb with
special private method __read/write_nonblock to reduce keyword
parameters overhead. We can move them into io.rb with builtin
functions.
2019-11-08 10:03:19 +09:00

37 lines
806 B
Ruby

class << Thread
# 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 exclusive(&block) end if false
mutex = Mutex.new # :nodoc:
define_method(:exclusive) do |&block|
warn "Thread.exclusive is deprecated, use Thread::Mutex", uplevel: 1
mutex.synchronize(&block)
end
end
class Binding
# :nodoc:
def irb
require 'irb'
irb
end
# suppress redefinition warning
alias irb irb # :nodoc:
end
module Kernel
def pp(*objs)
require 'pp'
pp(*objs)
end
# suppress redefinition warning
alias pp pp # :nodoc:
private :pp
end