mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
6ff75042db
path field into rb_iseq_t. The field contains a string representing a path to corresponding source file. or nil when the iseq is created from -e, stdin, eval, etc. This field is used for require_relative. [ruby-dev:40004] * load.c (rb_f_require_relative): add C implementation of require_relative. * prelude.rb (require_relative): get rid of Ruby implementation of require_relative. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
24 lines
292 B
Ruby
24 lines
292 B
Ruby
|
|
# Mutex
|
|
|
|
class Mutex
|
|
def synchronize
|
|
self.lock
|
|
begin
|
|
yield
|
|
ensure
|
|
self.unlock rescue nil
|
|
end
|
|
end
|
|
end
|
|
|
|
# Thread
|
|
|
|
class Thread
|
|
MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new
|
|
def self.exclusive
|
|
MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{
|
|
yield
|
|
}
|
|
end
|
|
end
|