Browse Source

Merge pull request #616 from Tetralux/fix-sync-badopt

Fix potential bad optimization bug in sync.Ticket_Mutex
gingerBill 5 years ago
parent
commit
197a72adde
1 changed files with 1 additions and 1 deletions
  1. 1 1
      core/sync/sync.odin

+ 1 - 1
core/sync/sync.odin

@@ -18,7 +18,7 @@ ticket_mutex_init :: proc(m: ^Ticket_Mutex) {
 
 ticket_mutex_lock :: inline proc(m: ^Ticket_Mutex) {
 	ticket := atomic_add(&m.ticket, 1, .Relaxed);
-	for ticket != m.serving {
+	for ticket != atomic_load(&m.serving, .Acquire) {
 		intrinsics.cpu_relax();
 	}
 }