This commit is contained in:
Andreas Rumpf 2023-05-21 21:29:05 +02:00 committed by GitHub
parent 4bc0b592e8
commit 7929634fad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -445,11 +445,9 @@ macro spawn*(tp: Taskpool, fnCall: typed): untyped =
# Package in a task # Package in a task
let taskNode = ident("taskNode") let taskNode = ident("taskNode")
let task = ident("task")
if not needFuture: if not needFuture:
result.add quote do: result.add quote do:
let `task` = toTask(`fnCall`) let `taskNode` = TaskNode.new(workerContext.currentTask, toTask(`fnCall`))
let `taskNode` = TaskNode.new(workerContext.currentTask, `task`)
schedule(workerContext, `taskNode`) schedule(workerContext, `taskNode`)
else: else:
@ -512,8 +510,7 @@ macro spawn*(tp: Taskpool, fnCall: typed): untyped =
asyncCall.add fut asyncCall.add fut
result.add quote do: result.add quote do:
let `task` = toTask(`asyncCall`) let `taskNode` = TaskNode.new(workerContext.currentTask, toTask(`asyncCall`))
let `taskNode` = TaskNode.new(workerContext.currentTask, `task`)
schedule(workerContext, `taskNode`) schedule(workerContext, `taskNode`)
# Return the future / flowvar # Return the future / flowvar