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

Michael Meeks michael.meeks at collabora.com
Tue Apr 5 11:24:06 UTC 2016


 loolwsd/LOOLBroker.cpp |    2 +-
 loolwsd/LOOLWSD.cpp    |   28 ++++++++++++++--------------
 2 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit d498bff3f074ca629e56211e1247cfeb2cb269e5
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Apr 5 12:23:02 2016 +0100

    Plural of child is children.

diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index 6dae2bd..ea75130 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -1159,7 +1159,7 @@ private:
         if (tokens[0] == "spawn" && tokens.count() == 2)
         {
             const auto count = std::stoi(tokens[1]);
-            Log::info("Spawning " + tokens[1] + " childs per request.");
+            Log::info("Spawning " + tokens[1] + " children on request.");
             ForkCounter = count;
         }
     }
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 9b91c85..194cad3 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -173,15 +173,15 @@ using Poco::XML::NodeList;
 
 /// New LOK child processes ready to host documents.
 //TODO: Move to a more sensible namespace.
-static std::vector<std::shared_ptr<ChildProcess>> newChilds;
-static std::mutex newChildsMutex;
-static std::condition_variable newChildsCV;
+static std::vector<std::shared_ptr<ChildProcess>> newChildren;
+static std::mutex newChildrenMutex;
+static std::condition_variable newChildrenCV;
 static std::map<std::string, std::shared_ptr<DocumentBroker>> docBrokers;
 static std::mutex docBrokersMutex;
 
 void forkChildren(int number)
 {
-    assert(!newChildsMutex.try_lock()); // check it is held.
+    assert(!newChildrenMutex.try_lock()); // check it is held.
 
     const std::string aMessage = "spawn " + std::to_string(number) + "\n";
     Log::debug("MasterToBroker: " + aMessage.substr(0, aMessage.length() - 1));
@@ -190,15 +190,15 @@ void forkChildren(int number)
 
 void preForkChildren()
 {
-    std::unique_lock<std::mutex> lock(newChildsMutex);
+    std::unique_lock<std::mutex> lock(newChildrenMutex);
     forkChildren(LOOLWSD::NumPreSpawnedChildren);
 }
 
 std::shared_ptr<ChildProcess> getNewChild()
 {
-    std::unique_lock<std::mutex> lock(newChildsMutex);
+    std::unique_lock<std::mutex> lock(newChildrenMutex);
 
-    const int available = newChilds.size();
+    const int available = newChildren.size();
     int balance = LOOLWSD::NumPreSpawnedChildren;
     if (available == 0)
     {
@@ -213,10 +213,10 @@ std::shared_ptr<ChildProcess> getNewChild()
         forkChildren(balance);
 
     const auto timeout = std::chrono::milliseconds(CHILD_TIMEOUT_SECS * 1000);
-    if (newChildsCV.wait_for(lock, timeout, [](){ return !newChilds.empty(); }))
+    if (newChildrenCV.wait_for(lock, timeout, [](){ return !newChildren.empty(); }))
     {
-        auto child = newChilds.back();
-        newChilds.pop_back();
+        auto child = newChildren.back();
+        newChildren.pop_back();
         return child;
     }
 
@@ -681,10 +681,10 @@ public:
 
             Log::info("New child [" + std::to_string(pid) + "].");
             auto ws = std::make_shared<WebSocket>(request, response);
-            std::unique_lock<std::mutex> lock(newChildsMutex);
-            newChilds.emplace_back(std::make_shared<ChildProcess>(pid, ws));
-            Log::info("Have " + std::to_string(newChilds.size()) + " childs.");
-            newChildsCV.notify_one();
+            std::unique_lock<std::mutex> lock(newChildrenMutex);
+            newChildren.emplace_back(std::make_shared<ChildProcess>(pid, ws));
+            Log::info("Have " + std::to_string(newChildren.size()) + " children.");
+            newChildrenCV.notify_one();
             return;
         }
 


More information about the Libreoffice-commits mailing list