[Libreoffice-commits] online.git: common/Util.cpp

Michael Meeks michael.meeks at collabora.com
Fri Mar 31 10:22:35 UTC 2017


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

New commits:
commit e79c5f908321cd04acad75a79ab50d47db982e44
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