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.
220 221 222 |
# File 'lib/uringmachine.rb', line 220 def done @done end |
#done_listeners ⇒ Object (readonly)
Returns the value of attribute done_listeners.
220 221 222 |
# File 'lib/uringmachine.rb', line 220 def done_listeners @done_listeners end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
220 221 222 |
# File 'lib/uringmachine.rb', line 220 def result @result end |
Instance Method Details
#add_done_listener(queue) ⇒ Object
Adds the given queue to the list of done listeners
238 239 240 |
# File 'lib/uringmachine.rb', line 238 def add_done_listener(queue) (@done_listeners ||= []) << queue end |
#done? ⇒ Boolean
Returns true if the fiber is done (terminated)
233 234 235 |
# File 'lib/uringmachine.rb', line 233 def done? @done end |
#mailbox ⇒ Object
Returns the fiber’s associated mailbox
243 244 245 |
# File 'lib/uringmachine.rb', line 243 def mailbox @mailbox ||= UM::Queue.new end |
#mark_as_done ⇒ Object
Marks the fiber as done (terminated)
223 224 225 |
# File 'lib/uringmachine.rb', line 223 def mark_as_done @done = true end |
#set_result(value) ⇒ Object
Sets the fiber return value
228 229 230 |
# File 'lib/uringmachine.rb', line 228 def set_result(value) @result = value end |