Do a bit less work for pool_join.

This commit is contained in:
Jeroen van Rijn
2022-05-13 15:11:33 +02:00
parent 7e0c359f99
commit 58fc305b11

View File

@@ -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)
}
}
}
}