Title: [210272] trunk/Source/WTF
Revision
210272
Author
utatane....@gmail.com
Date
2017-01-04 00:29:52 -0800 (Wed, 04 Jan 2017)

Log Message

Use prctl to name thread on Linux
https://bugs.webkit.org/show_bug.cgi?id=166663

Reviewed by Michael Catanzaro.

It is quite useful if we can name threads. This name will be shown in GDB.
While macOS uses pthread_setname_np, we can use prctl on Linux.

* wtf/ThreadingPthreads.cpp:
(WTF::initializeCurrentThreadInternal):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (210271 => 210272)


--- trunk/Source/WTF/ChangeLog	2017-01-04 07:52:05 UTC (rev 210271)
+++ trunk/Source/WTF/ChangeLog	2017-01-04 08:29:52 UTC (rev 210272)
@@ -1,5 +1,18 @@
 2017-01-03  Yusuke Suzuki  <utatane....@gmail.com>
 
+        Use prctl to name thread on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=166663
+
+        Reviewed by Michael Catanzaro.
+
+        It is quite useful if we can name threads. This name will be shown in GDB.
+        While macOS uses pthread_setname_np, we can use prctl on Linux.
+
+        * wtf/ThreadingPthreads.cpp:
+        (WTF::initializeCurrentThreadInternal):
+
+2017-01-03  Yusuke Suzuki  <utatane....@gmail.com>
+
         WorkQueueGeneric's platformInvalidate() can deadlock when called on the RunLoop's thread
         https://bugs.webkit.org/show_bug.cgi?id=166645
 

Modified: trunk/Source/WTF/wtf/ThreadingPthreads.cpp (210271 => 210272)


--- trunk/Source/WTF/wtf/ThreadingPthreads.cpp	2017-01-04 07:52:05 UTC (rev 210271)
+++ trunk/Source/WTF/wtf/ThreadingPthreads.cpp	2017-01-04 08:29:52 UTC (rev 210272)
@@ -55,6 +55,10 @@
 #include <sys/time.h>
 #endif
 
+#if OS(LINUX)
+#include <sys/prctl.h>
+#endif
+
 namespace WTF {
 
 class PthreadState {
@@ -192,6 +196,8 @@
 {
 #if HAVE(PTHREAD_SETNAME_NP)
     pthread_setname_np(threadName);
+#elif OS(LINUX)
+    prctl(PR_SET_NAME, threadName);
 #else
     UNUSED_PARAM(threadName);
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to