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