wolfpld / tracy

Frame profiler
https://tracy.nereid.pl/
Other
8.64k stars 595 forks source link

tracy::DecodeCallstackPtr crashes if called too early #767

Open not-magic opened 2 months ago

not-magic commented 2 months ago

The callstack decoder would be very useful to hook into for applications, e.g. to report a callstack on an assert or in a log.

This is almost doable now including #include <client/TracyCallstack.hpp> and using tracy::DecodeCallstackPtr

The issue I am running into is if you try to call it too early it will crash because the callstack background worker hasn't finished yet. All I would need is some way to wait on these threads but I can't see a way to do that. I am using it with vcpkg so I guess a feature would need to be added to define TRACY_DBGHELP_LOCK?

Currently my workaround is to just sleep until at least 1 second has passed since app startup before calling tracy::DecodeCallstackPtr