類別 DRb::ThreadObject
公開類別方法
new(&blk) 按一下以切換來源
呼叫超類別方法
MonitorMixin::new
# File lib/drb/drb.rb, line 1202 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
公開實例方法
_execute() { |req| ... } 按一下以切換來源
# File lib/drb/drb.rb, line 1237 def _execute() synchronize do @req_ev.wait_until { @status == :req } @res = yield(@req) @status = :res @res_ev.signal end end
alive?() 按一下以切換來源
# File lib/drb/drb.rb, line 1213 def alive? @thread.alive? end
kill() 按一下以切換來源
# File lib/drb/drb.rb, line 1217 def kill @thread.kill @thread.join end
method_missing(msg, *arg, &blk) 按一下以切換來源
# File lib/drb/drb.rb, line 1222 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