In Files

  • drb/drb.rb

Parent

Included Modules

DRb::ThreadObject

Public Class Methods

new(&blk) click to toggle source
 
               # File drb/drb.rb, line 1200
def initialize(&blk)
  super()
  @wait_ev = new_cond
  @req_ev = new_cond
  @res_ev = new_cond
  @status = :wait
  @req = nil
  @res = nil
  @thread = Thread.new(self, &blk)
end
            

Public Instance Methods

_execute() click to toggle source
 
               # File drb/drb.rb, line 1235
def _execute()
  synchronize do
    @req_ev.wait_until { @status == :req }
    @res = yield(@req)
    @status = :res
    @res_ev.signal
  end
end
            
alive?() click to toggle source
 
               # File drb/drb.rb, line 1211
def alive?
  @thread.alive?
end
            
kill() click to toggle source
 
               # File drb/drb.rb, line 1215
def kill
  @thread.kill
  @thread.join
end
            
method_missing(msg, *arg, &blk) click to toggle source
 
               # File drb/drb.rb, line 1220
def method_missing(msg, *arg, &blk)
  synchronize do
    @wait_ev.wait_until { @status == :wait }
    @req = [msg] + arg
    @status = :req
    @req_ev.broadcast
    @res_ev.wait_until { @status == :res }
    value = @res
    @req = @res = nil
    @status = :wait
    @wait_ev.broadcast
    return value
  end
end