Index: bolt/runtime/common.h =================================================================== --- bolt/runtime/common.h +++ bolt/runtime/common.h @@ -470,15 +470,11 @@ /// 1B mutex accessed by lock xchg class Mutex { - volatile bool InUse{false}; + volatile bool Result{false}; public: - bool acquire() { - bool Result = true; - asm volatile("lock; xchg %0, %1" : "+m"(InUse), "=r"(Result) : : "cc"); - return !Result; - } - void release() { InUse = false; } + bool acquire() { return !__atomic_test_and_set(&Result, __ATOMIC_ACQUIRE); } + void release() { __atomic_clear(&Result, __ATOMIC_RELEASE); } }; /// RAII wrapper for Mutex