mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-06 14:48:21 +00:00
Merge pull request #6403 from mifreundorfer/fix-auto-reset-event-deadlock
Fix auto reset event signal deadlock
This commit is contained in:
@@ -222,9 +222,10 @@ thread.
|
||||
*/
|
||||
auto_reset_event_signal :: proc "contextless" (e: ^Auto_Reset_Event) {
|
||||
old_status := atomic_load_explicit(&e.status, .Relaxed)
|
||||
new_status := old_status + 1 if old_status < 1 else 1
|
||||
for {
|
||||
if _, ok := atomic_compare_exchange_weak_explicit(&e.status, old_status, new_status, .Release, .Relaxed); ok {
|
||||
new_status := old_status + 1 if old_status < 1 else 1
|
||||
ok: bool
|
||||
if old_status, ok = atomic_compare_exchange_weak_explicit(&e.status, old_status, new_status, .Release, .Relaxed); ok {
|
||||
break
|
||||
}
|
||||
cpu_relax()
|
||||
|
||||
Reference in New Issue
Block a user