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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Jan 3 07:16:05 PST 2016


 loolwsd/Common.hpp  |    3 +++
 loolwsd/LOOLKit.cpp |    2 --
 loolwsd/LOOLWSD.cpp |    7 +++----
 loolwsd/LOOLWSD.hpp |    1 -
 4 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit 0869cace371ae235478b8813c55943e86c7caca3
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue Dec 29 19:55:26 2015 -0500

    loolwsd: consolidated TerminationFlag
    
    Change-Id: Ic06b940f3b48888e4f398816e5ee45c0f49046e3
    Reviewed-on: https://gerrit.libreoffice.org/21059
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/Common.hpp b/loolwsd/Common.hpp
index 4265957..02424f6 100644
--- a/loolwsd/Common.hpp
+++ b/loolwsd/Common.hpp
@@ -23,5 +23,8 @@ constexpr int PIPE_BUFFER = 1024;
 // The client port number, which is changed via loolwsd args.
 static int ClientPortNumber = DEFAULT_CLIENT_PORT_NUMBER;
 
+// Flag to stop pump loops.
+static volatile bool TerminationFlag = false;
+
 #endif
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 57771f1..37bf655 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -60,8 +60,6 @@ using Poco::FastMutex;
 const std::string CHILD_URI = "/loolws/child/";
 const std::string LOKIT_BROKER = "/tmp/loolbroker.fifo";
 
-static volatile bool TerminationFlag = false;
-
 namespace
 {
     void handleSignal(int aSignal)
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index ce391ad..fe95041 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -525,7 +525,7 @@ public:
                         }
                     }
                 }
-                while (!LOOLWSD::isShutDown &&
+                while (!TerminationFlag &&
                        (!pollTimeout || (n > 0 && (flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE)));
 
                 queue.clear();
@@ -677,7 +677,6 @@ Poco::NamedMutex LOOLWSD::NamedMutexLOOL("loolwsd");
 
 int LOOLWSD::NumPreSpawnedChildren = 10;
 bool LOOLWSD::doTest = false;
-volatile bool LOOLWSD::isShutDown = false;
 #if ENABLE_DEBUG
 int LOOLWSD::uid = 0;
 #endif
@@ -697,7 +696,7 @@ LOOLWSD::~LOOLWSD()
 void LOOLWSD::handleSignal(int aSignal)
 {
     Log::info() << "Signal received: " << strsignal(aSignal) << Log::end;
-    LOOLWSD::isShutDown = true;
+    TerminationFlag = true;
 }
 
 void LOOLWSD::setSignals(bool isIgnored)
@@ -954,7 +953,7 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
 
     int status = 0;
     unsigned timeoutCounter = 0;
-    while (!LOOLWSD::isShutDown && !LOOLWSD::doTest && MasterProcessSession::_childProcesses.size() > 0)
+    while (!TerminationFlag && !LOOLWSD::doTest && MasterProcessSession::_childProcesses.size() > 0)
     {
         pid_t pid = waitpid(-1, &status, WUNTRACED | WNOHANG);
         if (pid > 0)
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index aa16abd..d97addd 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -37,7 +37,6 @@ public:
     static int NumPreSpawnedChildren;
     static int BrokerWritePipe;
     static bool doTest;
-    static bool volatile isShutDown;
     static std::string cache;
     static std::string sysTemplate;
     static std::string loTemplate;


More information about the Libreoffice-commits mailing list