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 266
266:       def initialize(block)
267:         @block = block
268:         @waiter = Semaphore.new
269:         @exception = nil
270:       end

Public Instance methods

[Source]

     # File lib/xmpp4r/stream.rb, line 271
271:       def call(*args)
272:         @block.call(*args)
273:       end

[Source]

     # File lib/xmpp4r/stream.rb, line 282
282:       def raise(exception)
283:         @exception = exception
284:         @waiter.run
285:       end

[Source]

     # File lib/xmpp4r/stream.rb, line 274
274:       def wait
275:         @waiter.wait
276:         raise @exception if @exception
277:       end

[Source]

     # File lib/xmpp4r/stream.rb, line 278
278:       def wakeup
279:         # TODO: Handle threadblock removal if !alive?
280:         @waiter.run
281:       end

[Validate]