mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Support TRACY_NO_EXIT env variable in addition to define.
This commit is contained in:
parent
c3ba0ef4eb
commit
e285c837a4
@ -194,6 +194,7 @@ Profiler::Profiler()
|
||||
, m_epoch( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() )
|
||||
, m_shutdown( false )
|
||||
, m_sock( nullptr )
|
||||
, m_noExit( false )
|
||||
, m_stream( LZ4_createStream() )
|
||||
, m_buffer( (char*)tracy_malloc( TargetFrameSize*3 ) )
|
||||
, m_bufferOffset( 0 )
|
||||
@ -220,6 +221,14 @@ Profiler::Profiler()
|
||||
CalibrateTimer();
|
||||
CalibrateDelay();
|
||||
|
||||
#ifndef TRACY_NO_EXIT
|
||||
const char* noExitEnv = getenv( "TRACY_NO_EXIT" );
|
||||
if( noExitEnv && noExitEnv[0] == '1' )
|
||||
{
|
||||
m_noExit = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
s_thread = (Thread*)tracy_malloc( sizeof( Thread ) );
|
||||
new(s_thread) Thread( LaunchWorker, this );
|
||||
SetThreadName( s_thread->Handle(), "Tracy Profiler" );
|
||||
@ -293,7 +302,7 @@ void Profiler::Worker()
|
||||
for(;;)
|
||||
{
|
||||
#ifndef TRACY_NO_EXIT
|
||||
if( ShouldExit() ) return;
|
||||
if( !m_noExit && ShouldExit() ) return;
|
||||
#endif
|
||||
m_sock = listen.Accept();
|
||||
if( m_sock ) break;
|
||||
|
@ -401,6 +401,7 @@ private:
|
||||
uint64_t m_epoch;
|
||||
std::atomic<bool> m_shutdown;
|
||||
Socket* m_sock;
|
||||
bool m_noExit;
|
||||
|
||||
LZ4_stream_t* m_stream;
|
||||
char* m_buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user