mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Fix thread sanitizer errors surfaced by tests/core/io
This commit is contained in:
@@ -338,7 +338,7 @@ atomic_sema_wait :: proc "contextless" (s: ^Atomic_Sema) {
|
|||||||
original_count := atomic_load_explicit(&s.count, .Relaxed)
|
original_count := atomic_load_explicit(&s.count, .Relaxed)
|
||||||
for original_count == 0 {
|
for original_count == 0 {
|
||||||
futex_wait(&s.count, u32(original_count))
|
futex_wait(&s.count, u32(original_count))
|
||||||
original_count = s.count
|
original_count = atomic_load_explicit(&s.count, .Relaxed)
|
||||||
}
|
}
|
||||||
if original_count == atomic_compare_exchange_strong_explicit(&s.count, original_count, original_count-1, .Acquire, .Acquire) {
|
if original_count == atomic_compare_exchange_strong_explicit(&s.count, original_count, original_count-1, .Acquire, .Acquire) {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -122,9 +122,10 @@ pool_join :: proc(pool: ^Pool) {
|
|||||||
for started_count < len(pool.threads) {
|
for started_count < len(pool.threads) {
|
||||||
started_count = 0
|
started_count = 0
|
||||||
for t in pool.threads {
|
for t in pool.threads {
|
||||||
if .Started in t.flags {
|
flags := intrinsics.atomic_load(&t.flags)
|
||||||
|
if .Started in flags {
|
||||||
started_count += 1
|
started_count += 1
|
||||||
if .Joined not_in t.flags {
|
if .Joined not_in flags {
|
||||||
join(t)
|
join(t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user