Skip to content

Commit 7fa30d0

Browse files
author
Marcos Slomp
committed
clarification
1 parent 874d65b commit 7fa30d0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

public/client/TracyProfiler.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,9 +2148,15 @@ void Profiler::Worker()
21482148
while( s_symbolThreadGone.load() == false ) { YieldThread(); }
21492149
#endif
21502150

2151-
// Client is exiting.
21522151
#ifdef TRACY_HAS_SYSTEM_TRACING
2153-
// Stop filling queues with new data.
2152+
// On a typical shutdown scenario, the (global) Profiler object is destroyed by
2153+
// the C++ runtime when the client program returns from "main", and ~Profiler()
2154+
// takes care of calling StopSystemTracing(). However, a client may decide to
2155+
// manually RequestShutdown(), in which case ~Profile() may not execute before
2156+
// this Worker() thread goes through its teardown stages and reaches this point.
2157+
// To ensure that system tracing does not keep pushing data to the worker queue
2158+
// indefinitely (thus preventing this worker from terminating), we have to call
2159+
// StopSystemTracing() here as well to be safe:
21542160
StopSystemTracing();
21552161
#endif
21562162

0 commit comments

Comments
 (0)