From e1d87afe370a369e33d103d03537e9ea9f8fd2d7 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 15 Mar 2018 23:48:50 +1100 Subject: [PATCH] spinlock: prefer weak xchg when spinning --- job/spinlock.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/job/spinlock.cpp b/job/spinlock.cpp index 2e2ee98f..dc56368c 100644 --- a/job/spinlock.cpp +++ b/job/spinlock.cpp @@ -39,7 +39,7 @@ spinlock::lock (void) { do { bool expected = false; - if (held.compare_exchange_strong (expected, true)) + if (held.compare_exchange_weak (expected, true)) return; while (held)