lib/async/task.rb in async-1.0.0 vs lib/async/task.rb in async-1.1.0
- old
+ new
@@ -95,9 +95,14 @@
# @attr ios [Reactor] The reactor the task was created within.
attr :reactor
def_delegators :@reactor, :timeout, :sleep
+ # Yield back to the reactor and allow other fibers to execute.
+ def yield
+ self.sleep(0)
+ end
+
# @attr fiber [Fiber] The fiber which is being used for the execution of this task.
attr :fiber
def_delegators :@fiber, :alive?
# @attr status [Symbol] The status of the execution of the fiber, one of `:running`, `:complete`, `:stopped`, or `:failed`.