[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - common/Util.cpp

Michael Meeks michael.meeks at collabora.com
Fri Mar 31 10:24:27 UTC 2017


 common/Util.cpp |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 2a2f05f84bf16741198759ca5db25d7084dc3789
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Fri Mar 31 11:21:35 2017 +0100

    Use process name for a thread if no name is set (yet).

diff --git a/common/Util.cpp b/common/Util.cpp
index 70987c3b..8e9552b6 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -276,6 +276,13 @@ namespace Util
 
     const char *getThreadName()
     {
+        // Main process and/or not set yet.
+        if (ThreadName[0] == '\0')
+        {
+            if (prctl(PR_GET_NAME, reinterpret_cast<unsigned long>(ThreadName), 0, 0, 0) != 0)
+                ThreadName[0] = '\0';
+        }
+
         // Avoid so many redundant system calls
         return ThreadName;
     }
@@ -290,7 +297,6 @@ namespace Util
         return ThreadTid;
     }
 
-
     void getVersionInfo(std::string& version, std::string& hash)
     {
         version = std::string(LOOLWSD_VERSION);


More information about the Libreoffice-commits mailing list