From 58fc305b11f1f4fb4b5f7de037947f905e05f849 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Fri, 13 May 2022 15:11:33 +0200 Subject: [PATCH] Do a bit less work for pool_join. --- core/thread/thread_pool.odin | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/thread/thread_pool.odin b/core/thread/thread_pool.odin index 2ff3a6a52..840cecfec 100644 --- a/core/thread/thread_pool.odin +++ b/core/thread/thread_pool.odin @@ -103,14 +103,18 @@ pool_join :: proc(pool: ^Pool) { yield() + // Because we already stopped the pool, there's no need to take a lock here. + started_count: int for started_count < len(pool.threads) { started_count = 0 for t in pool.threads { if .Started in t.flags { - join(t) started_count += 1 } + if .Joined not_in t.flags { + join(t) + } } } }