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

Henry Castro hcastro at collabora.com
Tue Dec 29 06:50:05 PST 2015


 loolwsd/LOOLKit.cpp |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 24c8386c42728b09ddacb8d9965f95ef64e3621e
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue Dec 29 10:48:29 2015 -0400

    loolwsd: wait to finish callback worker thread

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 716f9e4..8b5e375 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -304,7 +304,7 @@ public:
         while (!TerminationFlag)
         {
             Notification::Ptr aNotification(_queue.waitDequeueNotification());
-            if (aNotification)
+            if (!TerminationFlag && aNotification)
             {
                 CallBackNotification::Ptr aCallBackNotification = aNotification.cast<CallBackNotification>();
                 if (aCallBackNotification)
@@ -339,6 +339,11 @@ public:
         Log::debug("Thread [" + thread_name + "] finished.");
     }
 
+    void wakeUpAll()
+    {
+        _queue.wakeUpAll();
+    }
+
 private:
     NotificationQueue& _queue;
     static FastMutex   _mutex;
@@ -702,8 +707,12 @@ void run_lok_main(const std::string &loSubPath, const std::string& childId, cons
             }
         }
 
-        close(readerBroker);
+        // wait callback worker finish
+        callbackWorker.wakeUpAll();
+        Poco::ThreadPool::defaultPool().joinAll();
+
         close(writerBroker);
+        close(readerBroker);
     }
     catch (const Exception& exc)
     {


More information about the Libreoffice-commits mailing list