mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
In case of manual shutdown, don't wait for lock.
All threads are freezed at this point, nothing will release it.
This commit is contained in:
parent
401ebd6f3d
commit
b371003336
@ -743,6 +743,7 @@ Profiler::Profiler()
|
|||||||
, m_mainThread( GetThreadHandle() )
|
, m_mainThread( GetThreadHandle() )
|
||||||
, m_epoch( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() )
|
, m_epoch( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() )
|
||||||
, m_shutdown( false )
|
, m_shutdown( false )
|
||||||
|
, m_shutdownManual( false )
|
||||||
, m_shutdownFinished( false )
|
, m_shutdownFinished( false )
|
||||||
, m_sock( nullptr )
|
, m_sock( nullptr )
|
||||||
, m_noExit( false )
|
, m_noExit( false )
|
||||||
@ -1129,10 +1130,21 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
|||||||
Profiler::DequeueStatus Profiler::DequeueSerial()
|
Profiler::DequeueStatus Profiler::DequeueSerial()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
while( !m_serialLock.try_lock() ) {}
|
bool lockHeld = true;
|
||||||
|
while( !m_serialLock.try_lock() )
|
||||||
|
{
|
||||||
|
if( m_shutdownManual.load( std::memory_order_relaxed ) )
|
||||||
|
{
|
||||||
|
lockHeld = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
m_serialQueue.swap( m_serialDequeue );
|
m_serialQueue.swap( m_serialDequeue );
|
||||||
|
if( lockHeld )
|
||||||
|
{
|
||||||
m_serialLock.unlock();
|
m_serialLock.unlock();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const auto sz = m_serialDequeue.size();
|
const auto sz = m_serialDequeue.size();
|
||||||
if( sz > 0 )
|
if( sz > 0 )
|
||||||
|
@ -342,7 +342,7 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void RequestShutdown() { m_shutdown.store( true, std::memory_order_relaxed ); }
|
void RequestShutdown() { m_shutdown.store( true, std::memory_order_relaxed ); m_shutdownManual.store( true, std::memory_order_relaxed ); }
|
||||||
bool HasShutdownFinished() const { return m_shutdownFinished.load( std::memory_order_relaxed ); }
|
bool HasShutdownFinished() const { return m_shutdownFinished.load( std::memory_order_relaxed ); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -424,6 +424,7 @@ private:
|
|||||||
uint64_t m_mainThread;
|
uint64_t m_mainThread;
|
||||||
uint64_t m_epoch;
|
uint64_t m_epoch;
|
||||||
std::atomic<bool> m_shutdown;
|
std::atomic<bool> m_shutdown;
|
||||||
|
std::atomic<bool> m_shutdownManual;
|
||||||
std::atomic<bool> m_shutdownFinished;
|
std::atomic<bool> m_shutdownFinished;
|
||||||
Socket* m_sock;
|
Socket* m_sock;
|
||||||
bool m_noExit;
|
bool m_noExit;
|
||||||
|
Loading…
Reference in New Issue
Block a user