Class Jabber::Stream::ThreadBlock
In: lib/xmpp4r/stream.rb
Parent: Object

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

Methods

call   new   raise   wait   wakeup  

Public Class methods

[Source]

     # File lib/xmpp4r/stream.rb, line 275
275:       def initialize(block)
276:         @block = block
277:         @waiter = Semaphore.new
278:         @exception = nil
279:       end

Public Instance methods

[Source]

     # File lib/xmpp4r/stream.rb, line 280
280:       def call(*args)
281:         @block.call(*args)
282:       end

[Source]

     # File lib/xmpp4r/stream.rb, line 291
291:       def raise(exception)
292:         @exception = exception
293:         @waiter.run
294:       end

[Source]

     # File lib/xmpp4r/stream.rb, line 283
283:       def wait
284:         @waiter.wait
285:         raise @exception if @exception
286:       end

[Source]

     # File lib/xmpp4r/stream.rb, line 287
287:       def wakeup
288:         # TODO: Handle threadblock removal if !alive?
289:         @waiter.run
290:       end

[Validate]