[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - net/Socket.cpp net/Socket.hpp wsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Tue May 16 14:34:03 UTC 2017
net/Socket.cpp | 1 +
net/Socket.hpp | 3 +++
wsd/LOOLWSD.cpp | 3 +++
3 files changed, 7 insertions(+)
New commits:
commit 684103104abfff50b18ad4cb1d591b25d1a0af59
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun May 14 21:42:10 2017 -0400
wsd: fix server shutdown
Thread-affinity checks must be inhibited
not just on Socket, but on the SocketPoll as well,
before destroying DocumentBroker instances.
Also, properly initialize the inhibit statics.
Change-Id: I2ced1554d477f0c3faf09bda74034cbae99e4ce1
Reviewed-on: https://gerrit.libreoffice.org/37608
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
(cherry picked from commit 7cff4fb08a2dba769a992300d24c0d5c3192b0a9)
Reviewed-on: https://gerrit.libreoffice.org/37612
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/net/Socket.cpp b/net/Socket.cpp
index 70b63e78..33652eb8 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -24,6 +24,7 @@
#include "WebSocketHandler.hpp"
int SocketPoll::DefaultPollTimeoutMs = 5000;
+std::atomic<bool> SocketPoll::InhibitThreadChecks(false);
std::atomic<bool> Socket::InhibitThreadChecks(false);
// help with initialization order
diff --git a/net/Socket.hpp b/net/Socket.hpp
index 89dd746e..8699db88 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -319,6 +319,7 @@ public:
/// Default poll time - useful to increase for debugging.
static int DefaultPollTimeoutMs;
+ static std::atomic<bool> InhibitThreadChecks;
/// Stop the polling thread.
void stop()
@@ -370,6 +371,8 @@ public:
/// Asserts in the debug builds, otherwise just logs.
void assertCorrectThread() const
{
+ if (InhibitThreadChecks)
+ return;
// 0 owner means detached and can be invoked by any thread.
const bool sameThread = (!isAlive() || _owner == std::thread::id(0) || std::this_thread::get_id() == _owner);
if (!sameThread)
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 47323ed7..da1e6535 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2189,6 +2189,7 @@ public:
{
// FIXME: add some stop-world magic before doing the dump(?)
Socket::InhibitThreadChecks = true;
+ SocketPoll::InhibitThreadChecks = true;
os << "LOOLWSDServer:\n"
<< " Ports: server " << ClientPortNumber
@@ -2217,6 +2218,7 @@ public:
i.second->dumpState(os);
Socket::InhibitThreadChecks = false;
+ SocketPoll::InhibitThreadChecks = false;
}
private:
@@ -2495,6 +2497,7 @@ int LOOLWSD::innerMain()
// Disable thread checking - we'll now cleanup lots of things if we can
Socket::InhibitThreadChecks = true;
+ SocketPoll::InhibitThreadChecks = true;
DocBrokers.clear();
More information about the Libreoffice-commits
mailing list