From 1de9f38131d4d80bd5ba0c8cd257122ae3c52766 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 29 Aug 2023 22:45:29 +0200 Subject: [PATCH] only notify master if runningTasks == 0 --- src/malebolgia.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/malebolgia.nim b/src/malebolgia.nim index 214b20b..c3cb4ad 100644 --- a/src/malebolgia.nim +++ b/src/malebolgia.nim @@ -47,7 +47,8 @@ proc taskCreated(m: var Master) {.inline.} = proc taskCompleted(m: var Master) {.inline.} = acquire(m.L) dec m.runningTasks - signal(m.c) + if m.runningTasks == 0: + signal(m.c) release(m.L) proc stillHaveTime*(m: Master): bool {.inline.} =