[Libreoffice-commits] online.git: Branch 'private/hcvcastro/forking' - loolwsd/LOOLKit.cpp loolwsd/LOOLWSD.cpp

Henry Castro hcastro at collabora.com
Thu Aug 6 06:40:09 PDT 2015


 loolwsd/LOOLKit.cpp |    3 +--
 loolwsd/LOOLWSD.cpp |   12 ++++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit ca67f647edc41b6871a46f5b5eaa92468953aa56
Author: Henry Castro <hcastro at collabora.com>
Date:   Thu Aug 6 09:38:56 2015 -0400

    loolwsd: set thread name to debug socket

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index fa5e9ab..09d0525 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -50,9 +50,8 @@ public:
     void run() override
     {
 #ifdef __linux
-      if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>("queue_handler"), 0, 0, 0) != 0) {
+      if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>("prisioner_handler"), 0, 0, 0) != 0)
         std::cout << Util::logPrefix() << "Cannot set thread name :" << strerror(errno) << std::endl;
-      }
 #endif
         while (true)
         {
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 84cb604..31b2cab 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -48,6 +48,7 @@ DEALINGS IN THE SOFTWARE.
 #include <sys/capability.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <sys/prctl.h>
 #endif
 
 #include <ftw.h>
@@ -233,6 +234,10 @@ public:
 
     void run() override
     {
+#ifdef __linux
+        if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>("client_handler"), 0, 0, 0) != 0)
+            std::cout << Util::logPrefix() << "Cannot set thread name :" << strerror(errno) << std::endl;
+#endif
         while (true)
         {
             std::string input = _queue.get();
@@ -283,6 +288,13 @@ public:
                 else
                     kind = LOOLSession::Kind::ToClient;
 
+#ifdef __linux
+                std::stringstream thread_name;
+                thread_name << kind;
+                if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(thread_name.str().c_str()), 0, 0, 0) != 0)
+                    std::cout << Util::logPrefix() << "Cannot set thread name :" << strerror(errno) << std::endl;
+#endif
+
                 std::shared_ptr<MasterProcessSession> session(new MasterProcessSession(ws, kind));
 
                 // For ToClient sessions, we store incoming messages in a queue and have a separate


More information about the Libreoffice-commits mailing list