loolwsd/LOOLBroker.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
New commits: commit 33ecd5ea2d6e1d13832d490748e7dba47f2ed239 Author: Tor Lillqvist <t...@collabora.com> Date: Tue Feb 16 10:48:10 2016 +0200 Introduce environment variable SLEEPKITFORDEBUGGER Sleeps a "kit" process after fork() for the specified number of seconds to give you time to attach it in the debugger. Also, if set, have the parent ("broker") process wait indefinitely the fifo to become writable. Also clarify the informative message for SLEEPFORDEBUGGER. diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 9e9089e..0b41fee 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -505,6 +505,14 @@ static int createLibreOfficeKit(const bool sharePages, if (!(pid = fork())) { // child + if (std::getenv("SLEEPKITFORDEBUGGER")) + { + std::cerr << "Sleeping " << std::getenv("SLEEPKITFORDEBUGGER") + << " seconds to give you time to attach debugger to process " + << Process::id() << std::endl; + Thread::sleep(std::stoul(std::getenv("SLEEPKITFORDEBUGGER")) * 1000); + } + lokit_main(childRoot, sysTemplate, loTemplate, loSubPath, pipeKit); _exit(Application::EXIT_OK); } @@ -544,11 +552,14 @@ static int createLibreOfficeKit(const bool sharePages, // open non-blocking to make sure that a broken lokit process will not // block the loolbroker forever { - short nRetries = 5; + int nRetries = 5; std::mutex aFIFOMutex; std::condition_variable aFIFOCV; std::unique_lock<std::mutex> lock(aFIFOMutex); + if (std::getenv("SLEEPKITFORDEBUGGER")) + nRetries = std::numeric_limits<int>::max(); + while(nRetries && nFIFOWriter < 0) { aFIFOCV.wait_for( @@ -620,7 +631,7 @@ int main(int argc, char** argv) if (std::getenv("SLEEPFORDEBUGGER")) { std::cerr << "Sleeping " << std::getenv("SLEEPFORDEBUGGER") - << " seconds to attach debugger to process " + << " seconds to give you time to attach debugger to process " << Process::id() << std::endl; Thread::sleep(std::stoul(std::getenv("SLEEPFORDEBUGGER")) * 1000); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits