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
- #wakeup ⇒ Object
Constructor Details
#initialize(block) ⇒ ThreadBlock
Returns a new instance of ThreadBlock.
343 344 345 346 |
# File 'lib/xmpp4r/stream.rb', line 343 def initialize(block) @thread = Thread.current @block = block end |
Instance Method Details
#call(*args) ⇒ Object
347 348 349 |
# File 'lib/xmpp4r/stream.rb', line 347 def call(*args) @block.call(*args) end |
#raise(exception) ⇒ Object
354 355 356 |
# File 'lib/xmpp4r/stream.rb', line 354 def raise(exception) @thread.raise(exception) if @thread.alive? end |
#wakeup ⇒ Object
350 351 352 353 |
# File 'lib/xmpp4r/stream.rb', line 350 def wakeup # TODO: Handle threadblock removal if !alive? @thread.wakeup if @thread.alive? end |