mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
pool_join should look at .Done.
This commit is contained in:
@@ -101,16 +101,13 @@ pool_join :: proc(pool: ^Pool) {
|
|||||||
intrinsics.atomic_store(&pool.is_running, false)
|
intrinsics.atomic_store(&pool.is_running, false)
|
||||||
sync.post(&pool.sem_available, len(pool.threads))
|
sync.post(&pool.sem_available, len(pool.threads))
|
||||||
|
|
||||||
yield()
|
|
||||||
|
|
||||||
// Because we already stopped the pool, there's no need to take a lock here.
|
// Because we already stopped the pool, there's no need to take a lock here.
|
||||||
|
done_count: int
|
||||||
started_count: int
|
for done_count < len(pool.threads) {
|
||||||
for started_count < len(pool.threads) {
|
done_count = 0
|
||||||
started_count = 0
|
|
||||||
for t in pool.threads {
|
for t in pool.threads {
|
||||||
if .Started in t.flags {
|
if .Done in t.flags {
|
||||||
started_count += 1
|
done_count += 1
|
||||||
if .Joined not_in t.flags {
|
if .Joined not_in t.flags {
|
||||||
join(t)
|
join(t)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user