Merge pull request #4189 from pkova/master

Fix thread sanitizer errors surfaced by tests/core/io
This commit is contained in:
gingerBill
2024-09-03 15:57:45 +01:00
committed by GitHub
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -338,7 +338,7 @@ atomic_sema_wait :: proc "contextless" (s: ^Atomic_Sema) {
original_count := atomic_load_explicit(&s.count, .Relaxed)
for original_count == 0 {
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) {
return
+3 -2
View File
@@ -122,9 +122,10 @@ pool_join :: proc(pool: ^Pool) {
for started_count < len(pool.threads) {
started_count = 0
for t in pool.threads {
if .Started in t.flags {
flags := intrinsics.atomic_load(&t.flags)
if .Started in flags {
started_count += 1
if .Joined not_in t.flags {
if .Joined not_in flags {
join(t)
}
}