瀏覽代碼

externals/microprofile: Fix data race in g_bUseLock

As reported by tsan, g_bUseLock had a data race. Fix this using an
atomic boolean.
ReinUsesLisp 5 年之前
父節點
當前提交
3dcaaa18be
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      externals/microprofile/microprofile.h

+ 1 - 1
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<bool> 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);