class Jabber::Stream::ThreadBlock

This is used by Jabber::Stream internally to keep track of any blocks which were passed to Jabber::Stream#send.

Public Class Methods

new(block) click to toggle source
# File lib/xmpp4r/stream.rb, line 322
def initialize(block)
  @block = block
  @waiter = Semaphore.new
  @exception = nil
end

Public Instance Methods

call(*args) click to toggle source
# File lib/xmpp4r/stream.rb, line 327
def call(*args)
  @block.call(*args)
end
raise(exception) click to toggle source
# File lib/xmpp4r/stream.rb, line 337
def raise(exception)
  @exception = exception
  @waiter.run
end
wait() click to toggle source
# File lib/xmpp4r/stream.rb, line 330
def wait
  @waiter.wait
  raise @exception if @exception
end
wakeup() click to toggle source
# File lib/xmpp4r/stream.rb, line 334
def wakeup
  @waiter.run
end