Use weak compare, yield thread.

This commit is contained in:
Bartosz Taudul 2021-05-31 02:22:13 +02:00
parent 94ec6a0d9d
commit 92fb197aac
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -64,6 +64,7 @@
#include "../common/TracyAlign.hpp"
#include "../common/TracySocket.hpp"
#include "../common/TracySystem.hpp"
#include "../common/TracyYield.hpp"
#include "../common/tracy_lz4.hpp"
#include "tracy_rpmalloc.hpp"
#include "TracyCallstack.hpp"
@ -1030,7 +1031,7 @@ static ProfilerData& GetProfilerData()
if( !ptr )
{
int expected = 0;
while( !profilerDataLock.compare_exchange_strong( expected, 1, std::memory_order_release, std::memory_order_relaxed ) ) { expected = 0; }
while( !profilerDataLock.compare_exchange_weak( expected, 1, std::memory_order_release, std::memory_order_relaxed ) ) { expected = 0; YieldThread(); }
ptr = profilerData.load( std::memory_order_acquire );
if( !ptr )
{