kernel/common/codeloader.rb
# Searches for and loads Ruby source files and shared library extension
# files. See CodeLoader.require for the rest of Kernel#require
# functionality.
Searches for and loads Ruby source files and shared library extension
files. See CodeLoader.require for the rest of Kernel#require
functionality.
Searches for and loads Ruby source files and shared library extension files . See CodeLoader . require for the rest of Kernel#require functionality .
def require
      wait = false
      req = nil
      reqs = CodeLoader.load_map
      Rubinius.synchronize(Lock) do
        return unless resolve_require_path
        if req = reqs[@load_path]
          return if req.current_thread?
          wait = true
        else
          req = RequireRequest.new(@type, reqs, @load_path)
          reqs[@load_path] = req
          req.take!
        end
      end
      if wait
        return if req.wait
      end
      if @type == :ruby
        load_file
      else
        load_library
      end
      return req
    end
def require wait = false req = nil reqs = CodeLoader . load_map Rubinius . synchronize ( Lock ) do return unless resolve_require_path if req = reqs [ @load_path ] return if req . current_thread? wait = true else req = RequireRequest . new ( @type , reqs , @load_path ) reqs [ @load_path ] = req req . take! end end if wait return if req . wait end if @type == :ruby load_file else load_library end return req end
Searches for and loads Ruby source files and shared library extension
files.
Searches for and loads Ruby source files and shared library extension files .
# The other thread doing the lock raised an exception # through the require, so we try and load it again here.