[Libreoffice-commits] online.git: loolwsd/LOOLKit.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Thu Jan 21 07:45:18 PST 2016
loolwsd/LOOLKit.cpp | 51 +++++++++++++++++++++------------------------------
1 file changed, 21 insertions(+), 30 deletions(-)
New commits:
commit 49d7c0e17f3f0b027a932f72295ef83995cc1232
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Tue Jan 19 20:31:36 2016 -0500
loolwsd: improved lokit callback notification dispatcher
Change-Id: I88abad83a3d06eb530200d921ef25b68465b82b6
Reviewed-on: https://gerrit.libreoffice.org/21675
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 0883b48..b779180 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -264,48 +264,40 @@ public:
while (!_stop && !TerminationFlag)
{
Notification::Ptr aNotification(_queue.waitDequeueNotification());
- if (!TerminationFlag && aNotification)
+ if (!_stop && !TerminationFlag && aNotification)
{
CallBackNotification::Ptr aCallBackNotification = aNotification.cast<CallBackNotification>();
- if (aCallBackNotification)
+ assert(aCallBackNotification);
+
+ const auto nType = aCallBackNotification->m_nType;
+ try
{
- const auto nType = aCallBackNotification->m_nType;
- try
- {
- callback(nType, aCallBackNotification->m_aPayload, aCallBackNotification->m_pSession);
- }
- catch (const Exception& exc)
- {
- Log::error() << "Error while handling callback [" << callbackTypeToString(nType) << "]. "
- << exc.displayText()
- << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
- << Log::end;
- }
- catch (const std::exception& exc)
- {
- Log::error("Error while handling callback [" + callbackTypeToString(nType) + "]. " +
- std::string("Exception: ") + exc.what());
- }
- catch (...)
- {
- Log::error("Unexpected Exception while handling callback [" + callbackTypeToString(nType) + "].");
- }
+ callback(nType, aCallBackNotification->m_aPayload, aCallBackNotification->m_pSession);
+ }
+ catch (const Exception& exc)
+ {
+ Log::error() << "Error while handling callback [" << callbackTypeToString(nType) << "]. "
+ << exc.displayText()
+ << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
+ << Log::end;
+ }
+ catch (const std::exception& exc)
+ {
+ Log::error("Error while handling callback [" + callbackTypeToString(nType) + "]. " +
+ std::string("Exception: ") + exc.what());
}
}
- else break;
+ else
+ break;
}
Log::debug("Thread [" + thread_name + "] finished.");
}
- void wakeUpAll()
- {
- _queue.wakeUpAll();
- }
-
void stop()
{
_stop = true;
+ _queue.wakeUpAll();
}
private:
@@ -491,7 +483,6 @@ public:
// Wait for the callback worker to finish.
_callbackWorker.stop();
- _callbackWorker.wakeUpAll();
_callbackThread.join();
// Flag all connections to stop.
More information about the Libreoffice-commits
mailing list