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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 9 06:17:19 UTC 2017


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

New commits:
commit 731bfb08c5a2937f0833f7e657e616ff1470c8c3
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Thu Jan 5 10:26:04 2017 -0500

    wsd: don't wait on the DocBrokers lock when prespawning children
    
    Prespawning proactively is optimistic, but is not critical.
    When getting a space child, more will be spawn perforce,
    so prespawnChildren shouldn't block.
    
    Change-Id: I60cc8c1ab87cba384ebc9aca9e79b89f69a99252
    Reviewed-on: https://gerrit.libreoffice.org/32858
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index b9467bd..0c60114 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -411,7 +411,13 @@ static void preForkChildren()
 static bool prespawnChildren(const bool force)
 {
     // First remove dead DocBrokers, if possible.
-    std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
+    std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex, std::defer_lock);
+    if (!docBrokersLock.try_lock())
+    {
+        // Busy, try again later.
+        return false;
+    }
+
     cleanupDocBrokers();
 
     std::unique_lock<std::mutex> lock(NewChildrenMutex, std::defer_lock);


More information about the Libreoffice-commits mailing list