net/Socket.cpp | 13 ++----------- net/Socket.hpp | 6 ++++++ 2 files changed, 8 insertions(+), 11 deletions(-)
New commits: commit d7858b08b90f989b0fe08c1f0309e4cd7f82c409 Author: Ashod Nakashian <[email protected]> Date: Sun Apr 2 18:43:21 2017 -0400 wsd: fix race in setting SocketPoll owner thread id Change-Id: Idace925ab02425ed66ac07efc22ab933d229d42e Reviewed-on: https://gerrit.libreoffice.org/36032 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/net/Socket.cpp b/net/Socket.cpp index 3a07470c..bac3a741 100644 --- a/net/Socket.cpp +++ b/net/Socket.cpp @@ -52,16 +52,8 @@ SocketPoll::SocketPoll(const std::string& threadName) throw std::runtime_error("Failed to allocate pipe for SocketPoll [" + threadName + "] waking."); } - { - std::lock_guard<std::mutex> lock(getPollWakeupsMutex()); - getWakeupsArray().push_back(_wakeup[1]); - } - -#if ENABLE_DEBUG - _owner = std::this_thread::get_id(); - LOG_DBG("Thread affinity of " << _name << " set to 0x" << - std::hex << _owner << "." << std::dec); -#endif + std::lock_guard<std::mutex> lock(getPollWakeupsMutex()); + getWakeupsArray().push_back(_wakeup[1]); } SocketPoll::~SocketPoll() @@ -92,7 +84,6 @@ void SocketPoll::startThread() try { _thread = std::thread(&SocketPoll::pollingThreadEntry, this); - _owner = _thread.get_id(); } catch (const std::exception& exc) { diff --git a/net/Socket.hpp b/net/Socket.hpp index 9977f481..200c389b 100644 --- a/net/Socket.hpp +++ b/net/Socket.hpp @@ -493,6 +493,12 @@ private: Util::setThreadName(_name); LOG_INF("Starting polling thread [" << _name << "]."); +#if ENABLE_DEBUG + _owner = std::this_thread::get_id(); + LOG_DBG("Thread affinity of " << _name << " set to 0x" << + std::hex << _owner << "." << std::dec); +#endif + // Invoke the virtual implementation. pollingThread(); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
