[Libreoffice-commits] online.git: net/Socket.hpp

Michael Meeks michael.meeks at collabora.com
Fri Mar 10 18:22:08 UTC 2017


 net/Socket.hpp |    6 ++++++
 1 file changed, 6 insertions(+)

New commits:
commit c30fb670d800d9f3ef9d6006af5308111320fd9a
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Mar 10 18:20:51 2017 +0000

    Work on LOOL_CHECK_THREADS=1 a little.
    
    The situation made more problematic since the std::thread is only
    created in startThread - so getting ownership right before then in
    Socket is problematic.

diff --git a/net/Socket.hpp b/net/Socket.hpp
index 9259d88..87b8dea 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -354,6 +354,11 @@ public:
                 // Copy the new sockets over and clear.
                 _pollSockets.insert(_pollSockets.end(),
                                     _newSockets.begin(), _newSockets.end());
+
+                // Update thread ownership.
+                for (auto &i : _newSockets)
+                    i->setThreadOwner(std::this_thread::get_id());
+
                 _newSockets.clear();
 
                 // Extract list of callbacks to process
@@ -395,6 +400,7 @@ public:
         if (newSocket)
         {
             std::lock_guard<std::mutex> lock(_mutex);
+            // Beware - _thread may not be created & started yet.
             newSocket->setThreadOwner(_thread.get_id());
             LOG_DBG("Inserting socket #" << newSocket->getFD() << " into " << _name);
             _newSockets.emplace_back(newSocket);


More information about the Libreoffice-commits mailing list