diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-05-14 13:34:52 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-05-14 13:34:52 +0200 |
| commit | 85edcf9cc204751ac8e7a8ac541df712caeb4014 (patch) | |
| tree | 4de7ca2a95cc72644bc44adabaca8c8ff3cbf50a /core/thread/thread_pool.odin | |
| parent | 3b842ffe29b272ffeccb7fea30d86bca97cb2fce (diff) | |
Revert.
Diffstat (limited to 'core/thread/thread_pool.odin')
| -rw-r--r-- | core/thread/thread_pool.odin | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/core/thread/thread_pool.odin b/core/thread/thread_pool.odin index d27ae4255..820de8ad4 100644 --- a/core/thread/thread_pool.odin +++ b/core/thread/thread_pool.odin @@ -101,13 +101,14 @@ pool_join :: proc(pool: ^Pool) { intrinsics.atomic_store(&pool.is_running, false) sync.post(&pool.sem_available, len(pool.threads)) - // Because we already stopped the pool, there's no need to take a lock here. - done_count: int - for done_count < len(pool.threads) { - done_count = 0 + yield() + +started_count: int + for started_count < len(pool.threads) { + started_count = 0 for t in pool.threads { - if .Done in t.flags { - done_count += 1 + if .Started in t.flags { + started_count += 1 if .Joined not_in t.flags { join(t) } |