diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-05-14 13:18:38 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-05-14 13:18:38 +0200 |
| commit | 6c0e2e2a53412b4d7ba8b2b3b9bd485af240589b (patch) | |
| tree | 8ce7fec14efb12895788df4fce7a5917962bcd33 /core/thread/thread_pool.odin | |
| parent | 42371f7aea986f7719972e7d3d7c4f93f3f4c490 (diff) | |
pool_join should look at .Done.
Diffstat (limited to 'core/thread/thread_pool.odin')
| -rw-r--r-- | core/thread/thread_pool.odin | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/core/thread/thread_pool.odin b/core/thread/thread_pool.odin index 4fd5c90d1..d27ae4255 100644 --- a/core/thread/thread_pool.odin +++ b/core/thread/thread_pool.odin @@ -101,16 +101,13 @@ pool_join :: proc(pool: ^Pool) { intrinsics.atomic_store(&pool.is_running, false) sync.post(&pool.sem_available, len(pool.threads)) - 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 + done_count: int + for done_count < len(pool.threads) { + done_count = 0 for t in pool.threads { - if .Started in t.flags { - started_count += 1 + if .Done in t.flags { + done_count += 1 if .Joined not_in t.flags { join(t) } |