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
- #call(*args) ⇒ Object
-
#initialize(block) ⇒ ThreadBlock
constructor
A new instance of ThreadBlock.
- #raise(exception) ⇒ Object
- #wait ⇒ Object
- #wakeup ⇒ Object
Constructor Details
#initialize(block) ⇒ ThreadBlock
Returns a new instance of ThreadBlock.
329 330 331 332 333 |
# File 'lib/xmpp4r/stream.rb', line 329 def initialize(block) @block = block @waiter = Semaphore.new @exception = nil end |
Instance Method Details
#call(*args) ⇒ Object
334 335 336 |
# File 'lib/xmpp4r/stream.rb', line 334 def call(*args) @block.call(*args) end |
#raise(exception) ⇒ Object
344 345 346 347 |
# File 'lib/xmpp4r/stream.rb', line 344 def raise(exception) @exception = exception @waiter.run end |
#wait ⇒ Object
337 338 339 340 |
# File 'lib/xmpp4r/stream.rb', line 337 def wait @waiter.wait raise @exception if @exception end |
#wakeup ⇒ Object
341 342 343 |
# File 'lib/xmpp4r/stream.rb', line 341 def wakeup @waiter.run end |