module DEBUGGER__::MultiProcessGroup

Public Instance Methods

after_fork(child: true) click to toggle source
# File debug-1.4.0/lib/debug/session.rb, line 1766
def after_fork child: true
  if child || !@lock_file
    @m = Mutex.new
    @lock_level = 0
    @lock_file = open(@lock_tempfile.path, 'w')
  end
end
info(msg) click to toggle source
# File debug-1.4.0/lib/debug/session.rb, line 1774
def info msg
  DEBUGGER__.info "#{msg} (#{@lock_level})" #  #{caller.first(1).map{|bt| bt.sub(__dir__, '')}}"
end
lock() click to toggle source
# File debug-1.4.0/lib/debug/session.rb, line 1816
def lock
  unless trylock
    @m.synchronize do
      if locked?
        lock_level_up
      else
        info "Lock: block"
        @lock_file.flock(File::LOCK_EX)
        lock_level_up
      end
    end

    info "Lock: success"
  end
end
locked?() click to toggle source
# File debug-1.4.0/lib/debug/session.rb, line 1778
def locked?
  # DEBUGGER__.info "locked? #{@lock_level}"
  @lock_level > 0
end
multi_process!() click to toggle source
# File debug-1.4.0/lib/debug/session.rb, line 1763
def multi_process!
end
sync(&b) click to toggle source
# File debug-1.4.0/lib/debug/session.rb, line 1841
def sync &b
  info "sync"

  lock
  begin
    b.call if b
  ensure
    unlock
  end
end
unlock() click to toggle source
# File debug-1.4.0/lib/debug/session.rb, line 1832
def unlock
  @m.synchronize do
    raise "lock file is not opened (#{@lock_file.inspect})" if @lock_file.closed?
    lock_level_down
    @lock_file.flock(File::LOCK_UN) unless locked?
    info "Unlocked"
  end
end