We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e5d84a commit 45b991bCopy full SHA for 45b991b
lib/async/task.rb
@@ -117,7 +117,9 @@ def run(*arguments)
117
if @status == :initialized
118
@status = :running
119
120
- schedule(arguments)
+ schedule do
121
+ @block.call(self, *arguments)
122
+ end
123
else
124
raise RuntimeError, "Task already running!"
125
end
@@ -247,12 +249,12 @@ def stop!
247
249
stop_children(true)
248
250
251
- def schedule(arguments)
252
+ def schedule(&block)
253
@fiber = Fiber.new do
254
set!
255
256
begin
- @result = @block.call(self, *arguments)
257
+ @result = yield
258
@status = :complete
259
# Console.logger.debug(self) {"Task was completed with #{@children.size} children!"}
260
rescue Stop
0 commit comments