Browse Source

Add `cpu_relax` to `sync.auto_reset_event_signal`

Feoramund 11 months ago
parent
commit
b1db33b519
1 changed files with 1 additions and 0 deletions
  1. 1 0
      core/sync/extended.odin

+ 1 - 0
core/sync/extended.odin

@@ -233,6 +233,7 @@ auto_reset_event_signal :: proc "contextless" (e: ^Auto_Reset_Event) {
 		if _, ok := atomic_compare_exchange_weak_explicit(&e.status, old_status, new_status, .Release, .Relaxed); ok {
 		if _, ok := atomic_compare_exchange_weak_explicit(&e.status, old_status, new_status, .Release, .Relaxed); ok {
 			break
 			break
 		}
 		}
+		cpu_relax()
 	}
 	}
 	if old_status < 0 {
 	if old_status < 0 {
 		sema_post(&e.sema)
 		sema_post(&e.sema)