mirror of
https://github.com/wolfpld/tracy.git
synced 2026-11-14 20:05:27 +00:00
Hold worker data lock for the whole draw frame
This commit is contained in:
@@ -339,6 +339,7 @@ static_assert( sizeof( CompressionName ) == sizeof( CompressionDesc ), "Unmatche
|
||||
|
||||
bool View::Draw()
|
||||
{
|
||||
Worker::MainThreadDataLockGuard lock = m_worker.ObtainLockForMainThread();
|
||||
HandshakeStatus status = (HandshakeStatus)m_worker.GetHandshakeStatus();
|
||||
switch( status )
|
||||
{
|
||||
@@ -863,7 +864,6 @@ bool View::DrawImpl()
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
Worker::MainThreadDataLockGuard lock = m_worker.ObtainLockForMainThread();
|
||||
auto& threadHints = m_worker.GetPendingThreadHints();
|
||||
if( !threadHints.empty() )
|
||||
{
|
||||
|
||||
@@ -79,7 +79,6 @@ bool View::DrawConnection()
|
||||
|
||||
FrameImage lastFrameImage{};
|
||||
{
|
||||
Worker::MainThreadDataLockGuard lock = m_worker.ObtainLockForMainThread();
|
||||
ImGui::SameLine();
|
||||
TextFocused( "+", RealToString( m_worker.GetSendInFlight() ) );
|
||||
const auto sz = m_worker.GetFrameCount( *m_frames );
|
||||
@@ -94,7 +93,7 @@ bool View::DrawConnection()
|
||||
TextFocused( "Frame time:", TimeToString( dt ) );
|
||||
}
|
||||
const auto& fis = m_worker.GetFrameImages();
|
||||
// Keep a copy here since the worker may modify the frame images vector while we do not own the lock
|
||||
// Keep a copy so the frame image data is retained independently of the worker storage.
|
||||
if( !fis.empty() ) lastFrameImage = *fis.back();
|
||||
}
|
||||
|
||||
@@ -130,7 +129,6 @@ bool View::DrawConnection()
|
||||
|
||||
ImGui::SameLine( 0, 2 * ty );
|
||||
const char* stopStr = ICON_FA_PLUG " Stop";
|
||||
Worker::MainThreadDataLockGuard lock = m_worker.ObtainLockForMainThread();
|
||||
if( !m_disconnectIssued && m_worker.IsConnected() )
|
||||
{
|
||||
if( ImGui::Button( stopStr ) )
|
||||
|
||||
Reference in New Issue
Block a user