Module: UringMachine::FiberExtensions
- Defined in:
- lib/uringmachine.rb
Overview
Fiber extensions
Instance Attribute Summary collapse
-
#done ⇒ Object
readonly
Returns the value of attribute done.
-
#done_listeners ⇒ Object
readonly
Returns the value of attribute done_listeners.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#add_done_listener(queue) ⇒ Object
Adds the given queue to the list of done listeners.
-
#done? ⇒ Boolean
Returns true if the fiber is done (terminated).
-
#mailbox ⇒ Object
Returns the fiber’s associated mailbox.
-
#mark_as_done ⇒ Object
Marks the fiber as done (terminated).
-
#set_result(value) ⇒ Object
Sets the fiber return value.
Instance Attribute Details
#done ⇒ Object (readonly)
Returns the value of attribute done.
311 312 313 |
# File 'lib/uringmachine.rb', line 311 def done @done end |
#done_listeners ⇒ Object (readonly)
Returns the value of attribute done_listeners.
311 312 313 |
# File 'lib/uringmachine.rb', line 311 def done_listeners @done_listeners end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
311 312 313 |
# File 'lib/uringmachine.rb', line 311 def result @result end |
Instance Method Details
#add_done_listener(queue) ⇒ Object
Adds the given queue to the list of done listeners
329 330 331 |
# File 'lib/uringmachine.rb', line 329 def add_done_listener(queue) (@done_listeners ||= []) << queue end |
#done? ⇒ Boolean
Returns true if the fiber is done (terminated)
324 325 326 |
# File 'lib/uringmachine.rb', line 324 def done? @done end |
#mailbox ⇒ Object
Returns the fiber’s associated mailbox
334 335 336 |
# File 'lib/uringmachine.rb', line 334 def mailbox @mailbox ||= UM::Queue.new end |
#mark_as_done ⇒ Object
Marks the fiber as done (terminated)
314 315 316 |
# File 'lib/uringmachine.rb', line 314 def mark_as_done @done = true end |
#set_result(value) ⇒ Object
Sets the fiber return value
319 320 321 |
# File 'lib/uringmachine.rb', line 319 def set_result(value) @result = value end |