[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - common/SigUtil.cpp common/SigUtil.hpp ios/Mobile wsd/DocumentBroker.hpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue May 14 19:49:34 UTC 2019
common/SigUtil.cpp | 4 ++++
common/SigUtil.hpp | 4 ++++
ios/Mobile/DocumentViewController.mm | 5 +++++
wsd/DocumentBroker.hpp | 7 +++++++
4 files changed, 20 insertions(+)
New commits:
commit 6087bd1fbbd8fb5df405ea3e5ee3beaed3ea4c0d
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Tue May 14 22:37:11 2019 +0300
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Tue May 14 22:48:40 2019 +0300
Introduce new flag to speed up shutdown of the Online plumbing in the iOS app
Spent hours on trying to cleverly use the existing TerminationFlag
(with minor modifications to the code that checks it, and some
additional code to set and reset it), but could not get it to work.
This is simpler, but sure, using a global variable is ugly of course.
At least the new MobileTerminationFlag is very specific in semantics
and only used in the mobile apps.
Change-Id: I0775fdfa7880750ca12c6fd7ec41d3d3ceb2f0ad
diff --git a/common/SigUtil.cpp b/common/SigUtil.cpp
index 236fef176..428096858 100644
--- a/common/SigUtil.cpp
+++ b/common/SigUtil.cpp
@@ -39,6 +39,10 @@
std::atomic<bool> TerminationFlag(false);
std::atomic<bool> DumpGlobalState(false);
+#if MOBILEAPP
+std::atomic<bool> MobileTerminationFlag(false);
+#endif
+
#if !MOBILEAPP
std::atomic<bool> ShutdownRequestFlag(false);
diff --git a/common/SigUtil.hpp b/common/SigUtil.hpp
index 7c247ad0d..39706372d 100644
--- a/common/SigUtil.hpp
+++ b/common/SigUtil.hpp
@@ -26,6 +26,10 @@ extern std::atomic<bool> TerminationFlag;
/// Flag to dump internal state
extern std::atomic<bool> DumpGlobalState;
+#if MOBILEAPP
+extern std::atomic<bool> MobileTerminationFlag;
+#endif
+
#if !MOBILEAPP
/// Mutex to trap signal handler, if any,
diff --git a/ios/Mobile/DocumentViewController.mm b/ios/Mobile/DocumentViewController.mm
index 76e64d0d8..ff2d2f1ab 100644
--- a/ios/Mobile/DocumentViewController.mm
+++ b/ios/Mobile/DocumentViewController.mm
@@ -17,6 +17,7 @@
#import "ios.h"
#import "FakeSocket.hpp"
#import "Log.hpp"
+#import "SigUtil.hpp"
#import "Util.hpp"
#import "DocumentViewController.h"
@@ -201,6 +202,10 @@
// is saved by closing it.
fakeSocketClose(self->closeNotificationPipeForForwardingThread[1]);
+ // Flag to make the inter-thread plumbing in the Online
+ // bits go away quicker.
+ MobileTerminationFlag = true;
+
// Close our end of the fake socket connection to the
// ClientSession thread, so that it terminates
fakeSocketClose(self.document->fakeClientFd);
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index e470d0c8c..dc2c19252 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -48,6 +48,13 @@ public:
bool continuePolling() override
{
+#if MOBILEAPP
+ if (MobileTerminationFlag)
+ {
+ MobileTerminationFlag = false;
+ return false;
+ }
+#endif
return SocketPoll::continuePolling() && !TerminationFlag;
}
};
More information about the Libreoffice-commits
mailing list