Class: Jabber::Stream::ThreadBlock
- Inherits:
-
Object
- Object
- Jabber::Stream::ThreadBlock
- Defined in:
- lib/xmpp4r/stream.rb
Overview
This is used by Jabber::Stream internally to keep track of any blocks which were passed to Stream#send.
Instance Method Summary (collapse)
- - (Object) call(*args)
-
- (ThreadBlock) initialize(block)
constructor
A new instance of ThreadBlock.
- - (Object) raise(exception)
- - (Object) wait
- - (Object) wakeup
Constructor Details
- (ThreadBlock) initialize(block)
A new instance of ThreadBlock
322 323 324 325 326 |
# File 'lib/xmpp4r/stream.rb', line 322 def initialize(block) @block = block @waiter = Semaphore.new @exception = nil end |
Instance Method Details
- (Object) call(*args)
327 328 329 |
# File 'lib/xmpp4r/stream.rb', line 327 def call(*args) @block.call(*args) end |
- (Object) raise(exception)
337 338 339 340 |
# File 'lib/xmpp4r/stream.rb', line 337 def raise(exception) @exception = exception @waiter.run end |
- (Object) wait
330 331 332 333 |
# File 'lib/xmpp4r/stream.rb', line 330 def wait @waiter.wait raise @exception if @exception end |
- (Object) wakeup
334 335 336 |
# File 'lib/xmpp4r/stream.rb', line 334 def wakeup @waiter.run end |