From 7fa30d08b520fe1a3b84aca276dda30af933761c Mon Sep 17 00:00:00 2001 From: Marcos Slomp Date: Wed, 3 Dec 2025 12:41:44 -0800 Subject: [PATCH] clarification --- public/client/TracyProfiler.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public/client/TracyProfiler.cpp b/public/client/TracyProfiler.cpp index e5f54fd3..d073f0bb 100644 --- a/public/client/TracyProfiler.cpp +++ b/public/client/TracyProfiler.cpp @@ -2148,9 +2148,15 @@ void Profiler::Worker() while( s_symbolThreadGone.load() == false ) { YieldThread(); } #endif - // Client is exiting. #ifdef TRACY_HAS_SYSTEM_TRACING - // Stop filling queues with new data. + // On a typical shutdown scenario, the (global) Profiler object is destroyed by + // the C++ runtime when the client program returns from "main", and ~Profiler() + // takes care of calling StopSystemTracing(). However, a client may decide to + // manually RequestShutdown(), in which case ~Profile() may not execute before + // this Worker() thread goes through its teardown stages and reaches this point. + // To ensure that system tracing does not keep pushing data to the worker queue + // indefinitely (thus preventing this worker from terminating), we have to call + // StopSystemTracing() here as well to be safe: StopSystemTracing(); #endif