From 9f7304c780ba4950d4bd23063712677cda16c671 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 3 Aug 2018 15:17:11 +0100 Subject: [PATCH] Add sleep to posix library startup to avoid race. Closes #857 * On win32 we can get the target control port instantly and immediately connect before program startup, on posix systems we must wait until afterwards and poll for open sockets. * This means there's a small window of opportunity where the program may have started running but we haven't connected yet to send any initial commands. Adding a sleep should give target control time to connect. --- renderdoc/os/posix/posix_libentry.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/renderdoc/os/posix/posix_libentry.cpp b/renderdoc/os/posix/posix_libentry.cpp index dbdd3ea10..d32ae7a4f 100644 --- a/renderdoc/os/posix/posix_libentry.cpp +++ b/renderdoc/os/posix/posix_libentry.cpp @@ -69,6 +69,10 @@ void library_loaded() RDCLOG("Loading into %s", curfile.c_str()); LibraryHooks::RegisterHooks(); + + // we have a short sleep here to allow target control to connect, since unlike windows we can't + // suspend the process during startup. + Threading::Sleep(15); } }