mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Merge pull request #5327 from nubunto/fix/pool-join-hangs
fix: pool_join hangs if no threads are started
This commit is contained in:
@@ -120,6 +120,20 @@ pool_join :: proc(pool: ^Pool) {
|
|||||||
|
|
||||||
yield()
|
yield()
|
||||||
|
|
||||||
|
unstarted_count: int
|
||||||
|
for t in pool.threads {
|
||||||
|
flags := intrinsics.atomic_load(&t.flags)
|
||||||
|
if .Started not_in flags {
|
||||||
|
unstarted_count += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// most likely the user forgot to call `pool_start`
|
||||||
|
// exit here, so we don't hang forever
|
||||||
|
if len(pool.threads) == unstarted_count {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
started_count: int
|
started_count: int
|
||||||
for started_count < len(pool.threads) {
|
for started_count < len(pool.threads) {
|
||||||
started_count = 0
|
started_count = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user