aboutsummaryrefslogtreecommitdiff
path: root/core/thread/thread_pool.odin
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2022-05-13 15:11:33 +0200
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2022-05-13 15:11:33 +0200
commit58fc305b11f1f4fb4b5f7de037947f905e05f849 (patch)
tree58ceadfeaf56338866d937c0ea3ed7fa50876b48 /core/thread/thread_pool.odin
parent7e0c359f993bb595ac794518bf882414133cd1c2 (diff)
Do a bit less work for pool_join.
Diffstat (limited to 'core/thread/thread_pool.odin')
-rw-r--r--core/thread/thread_pool.odin6
1 files changed, 5 insertions, 1 deletions
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)
+ }
}
}
}