From 3dcaaa18be1cf60bd0447f1dff6e4fa1ad175cf9 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Wed, 26 Aug 2020 02:22:34 +0000 Subject: [PATCH] externals/microprofile: Fix data race in g_bUseLock As reported by tsan, g_bUseLock had a data race. Fix this using an atomic boolean. --- externals/microprofile/microprofile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/externals/microprofile/microprofile.h b/externals/microprofile/microprofile.h index 6dae65a66..85d5bd5de 100644 --- a/externals/microprofile/microprofile.h +++ b/externals/microprofile/microprofile.h @@ -1037,7 +1037,7 @@ static void MicroProfileCreateThreadLogKey() #else MP_THREAD_LOCAL MicroProfileThreadLog* g_MicroProfileThreadLog = 0; #endif -static bool g_bUseLock = false; /// This is used because windows does not support using mutexes under dll init(which is where global initialization is handled) +static std::atomic g_bUseLock{false}; /// This is used because windows does not support using mutexes under dll init(which is where global initialization is handled) MICROPROFILE_DEFINE(g_MicroProfileFlip, "MicroProfile", "MicroProfileFlip", 0x3355ee);