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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed Jan 6 09:05:00 PST 2016


 loolwsd/LOOLBroker.cpp |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 9285f50c6b51eda14c0b41138944c42c0363bb16
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed Jan 6 10:08:54 2016 -0500

    loolwsd: kit instance forkCounter now atomic
    
    Change-Id: I04470220b83940319ff1a0fee865201433f44016
    Reviewed-on: https://gerrit.libreoffice.org/21167
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index b4ea7d8..12bde23 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -15,6 +15,7 @@
 #include <unistd.h>
 #include <dlfcn.h>
 
+#include <atomic>
 #include <mutex>
 #include <cstring>
 #include <cassert>
@@ -66,7 +67,7 @@ const std::string BROKER_PREFIX = "/tmp/lokit";
 static int readerChild = -1;
 static int readerBroker = -1;
 
-static unsigned int forkCounter = 0;
+static std::atomic<unsigned> forkCounter;
 static unsigned int childCounter = 0;
 static unsigned int numPreSpawnedChildren = 0;
 
@@ -782,7 +783,7 @@ int main(int argc, char** argv)
         if (forkCounter > 0)
         {
             forkMutex.lock();
-            forkCounter--;
+            --forkCounter;
 
             if (createLibreOfficeKit(sharePages, loSubPath, childId) < 0)
                 Log::error("Error: fork failed.");


More information about the Libreoffice-commits mailing list