Index: lib/xray/xray_fdr_logging.cc =================================================================== --- lib/xray/xray_fdr_logging.cc +++ lib/xray/xray_fdr_logging.cc @@ -42,7 +42,7 @@ // NOTE: This is a pointer to avoid having to do atomic operations at // initialization time. This is OK to leak as there will only be one bufferqueue // for the runtime, initialized once through the fdrInit(...) sequence. -std::shared_ptr* BQ = nullptr; +std::shared_ptr *BQ = nullptr; __sanitizer::atomic_sint32_t LogFlushStatus = { XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING}; @@ -207,7 +207,6 @@ auto TSC_CPU = getTimestamp(); auto &TSC = std::get<0>(TSC_CPU); auto &CPU = std::get<1>(TSC_CPU); - thread_local bool Running = false; RecursionGuard Guard{Running}; if (!Guard) { assert(Running && "RecursionGuard is buggy!"); @@ -298,7 +297,9 @@ using namespace __xray; if (flags()->xray_fdr_log) { XRayLogImpl Impl{ - fdrLoggingInit, fdrLoggingFinalize, fdrLoggingHandleArg0, + fdrLoggingInit, + fdrLoggingFinalize, + fdrLoggingHandleArg0, fdrLoggingFlush, }; __xray_set_log_impl(Impl); Index: lib/xray/xray_fdr_logging_impl.h =================================================================== --- lib/xray/xray_fdr_logging_impl.h +++ lib/xray/xray_fdr_logging_impl.h @@ -571,6 +571,8 @@ } } +thread_local volatile bool Running = false; + inline void processFunctionHook( int32_t FuncId, XRayEntryType Entry, uint64_t TSC, unsigned char CPU, int (*wall_clock_reader)(clockid_t, struct timespec *), @@ -581,7 +583,6 @@ // don't want to be clobbering potentially partial writes already happening in // the thread. We use a simple thread_local latch to only allow one on-going // handleArg0 to happen at any given time. - thread_local volatile bool Running = false; RecursionGuard Guard{Running}; if (!Guard) { assert(Running == true && "RecursionGuard is buggy!");