[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed May 4 10:33:24 UTC 2016


 loolwsd/LOOLWSD.cpp |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 8b18038718f88708dbd08aa61fe60edde3ff7af1
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue May 3 08:36:53 2016 -0400

    loolwsd: prespawnChildren should be forgiving when lock is not available
    
    Change-Id: Id84aa873113f7d3d575ad10504582d93eff51baa
    Reviewed-on: https://gerrit.libreoffice.org/24637
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 55329af..d4d8dcc 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -189,7 +189,12 @@ static void preForkChildren()
 
 static void prespawnChildren()
 {
-    std::unique_lock<std::mutex> lock(newChildrenMutex);
+    std::unique_lock<std::mutex> lock(newChildrenMutex, std::defer_lock);
+    if (!lock.try_lock())
+    {
+        // We are forking already? Try later.
+        return;
+    }
 
     for (int i = newChildren.size() - 1; i >= 0; --i)
     {


More information about the Libreoffice-commits mailing list