mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Proper handling of disconnect request.
This commit is contained in:
@@ -817,11 +817,12 @@ bool View::DrawConnection()
|
||||
const char* stopStr = "Stop";
|
||||
#endif
|
||||
std::shared_lock<std::shared_mutex> lock( m_worker.GetDataLock() );
|
||||
if( m_worker.IsConnected() )
|
||||
if( !m_disconnectIssued && m_worker.IsConnected() )
|
||||
{
|
||||
if( ImGui::Button( stopStr ) )
|
||||
{
|
||||
m_worker.Disconnect();
|
||||
m_disconnectIssued = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -271,6 +271,7 @@ private:
|
||||
ImGuiTextFilter m_messageFilter;
|
||||
bool m_messageFilterWasActive = false;
|
||||
int m_visibleMessages = 0;
|
||||
bool m_disconnectIssued = false;
|
||||
|
||||
Region m_highlight;
|
||||
Region m_highlightZoom;
|
||||
|
||||
@@ -1948,7 +1948,7 @@ void Worker::Exec()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( !m_crashed )
|
||||
if( !m_crashed && !m_disconnect )
|
||||
{
|
||||
bool done = true;
|
||||
for( auto& v : m_data.threads )
|
||||
@@ -4193,6 +4193,12 @@ void Worker::ReadTimelinePre044( FileRead& f, Vector<GpuEvent*>& vec, uint64_t s
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::Disconnect()
|
||||
{
|
||||
Query( ServerQueryDisconnect, 0 );
|
||||
m_disconnect = true;
|
||||
}
|
||||
|
||||
void Worker::Write( FileWrite& f )
|
||||
{
|
||||
f.Write( FileHeader, sizeof( FileHeader ) );
|
||||
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
bool IsDataStatic() const { return !m_thread.joinable(); }
|
||||
bool IsBackgroundDone() const { return m_backgroundDone.load( std::memory_order_relaxed ); }
|
||||
void Shutdown() { m_shutdown.store( true, std::memory_order_relaxed ); }
|
||||
void Disconnect() { Shutdown(); } // TODO: Needs proper implementation.
|
||||
void Disconnect();
|
||||
|
||||
void Write( FileWrite& f );
|
||||
int GetTraceVersion() const { return m_traceVersion; }
|
||||
@@ -498,6 +498,7 @@ private:
|
||||
std::string m_hostInfo;
|
||||
bool m_terminate = false;
|
||||
bool m_crashed = false;
|
||||
bool m_disconnect = false;
|
||||
LZ4_streamDecode_t* m_stream;
|
||||
char* m_buffer;
|
||||
int m_bufferOffset;
|
||||
|
||||
Reference in New Issue
Block a user