This commit is contained in:
Joshua Kriegshauser 2024-09-24 13:48:40 -07:00
parent 5213c53bb0
commit 201dcb6a8a
2 changed files with 3 additions and 2 deletions

View File

@ -1473,10 +1473,11 @@ Profiler::Profiler()
m_pipeBufSize = 16384; m_pipeBufSize = 16384;
# else # else
m_pipeBufSize = (int)(ptrdiff_t)m_safeSendBufferSize; 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 /= 2; // too big; reduce
m_pipeBufSize = fcntl( m_pipe[0], F_GETPIPE_SZ ); m_pipeBufSize = fcntl( m_pipe[0], F_GETPIPE_SZ );
# endif # endif
fcntl( m_pipe[1], F_SETFL, O_NONBLOCK );
#endif #endif
#if !defined(TRACY_DELAYED_INIT) || !defined(TRACY_MANUAL_LIFETIME) #if !defined(TRACY_DELAYED_INIT) || !defined(TRACY_MANUAL_LIFETIME)

View File

@ -862,7 +862,7 @@ private:
// Send through the pipe to ensure safe reads // Send through the pipe to ensure safe reads
for( size_t offset = 0; offset != size; /*in loop*/ ) 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; ssize_t result1, result2;
while( ( result1 = write( m_pipe[1], p + offset, sendsize ) ) < 0 && errno == EINTR ) while( ( result1 = write( m_pipe[1], p + offset, sendsize ) ) < 0 && errno == EINTR )
/* retry */; /* retry */;