From 201dcb6a8a576fcdf97894db5038c55f06266cb5 Mon Sep 17 00:00:00 2001 From: Joshua Kriegshauser Date: Tue, 24 Sep 2024 13:48:40 -0700 Subject: [PATCH] Tweaks --- public/client/TracyProfiler.cpp | 3 ++- public/client/TracyProfiler.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/client/TracyProfiler.cpp b/public/client/TracyProfiler.cpp index fc42268b..6061f2ff 100644 --- a/public/client/TracyProfiler.cpp +++ b/public/client/TracyProfiler.cpp @@ -1473,10 +1473,11 @@ Profiler::Profiler() m_pipeBufSize = 16384; # else m_pipeBufSize = (int)(ptrdiff_t)m_safeSendBufferSize; - while( fcntl( m_pipe[0], F_SETPIPE_SZ, m_pipeBufSize ) == -1 && errno == EPERM ) + while( fcntl( m_pipe[0], F_SETPIPE_SZ, m_pipeBufSize ) < 0 && errno == EPERM ) m_pipeBufSize /= 2; // too big; reduce m_pipeBufSize = fcntl( m_pipe[0], F_GETPIPE_SZ ); # endif + fcntl( m_pipe[1], F_SETFL, O_NONBLOCK ); #endif #if !defined(TRACY_DELAYED_INIT) || !defined(TRACY_MANUAL_LIFETIME) diff --git a/public/client/TracyProfiler.hpp b/public/client/TracyProfiler.hpp index b559a71b..69707de1 100644 --- a/public/client/TracyProfiler.hpp +++ b/public/client/TracyProfiler.hpp @@ -862,7 +862,7 @@ private: // Send through the pipe to ensure safe reads for( size_t offset = 0; offset != size; /*in loop*/ ) { - size_t sendsize = std::min( size - offset, (size_t)(ptrdiff_t)m_pipeBufSize ); + size_t sendsize = size - offset; ssize_t result1, result2; while( ( result1 = write( m_pipe[1], p + offset, sendsize ) ) < 0 && errno == EINTR ) /* retry */;