ensure task destructor is run

This commit is contained in:
Mamy Ratsimbazafy 2021-09-29 10:47:08 +02:00
parent 176656044b
commit e1fa0ec097
1 changed files with 1 additions and 0 deletions

View File

@ -193,6 +193,7 @@ proc new(T: type TaskNode, parent: TaskNode, task: sink Task): T =
proc runTask(tn: var TaskNode) {.raises:[Exception], inline.} =
## Run a task and consumes the taskNode
tn.task.invoke()
tn.task.`=destroy`()
tn.c_free()
proc schedule(ctx: WorkerContext, tn: sink TaskNode) {.inline.} =