summaryrefslogtreecommitdiff
path: root/legacy/mozjs/6006_musl_pthread_setname.patch
blob: 213509ff7e3f30bb22d7eca42c79c5f9456ad5e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From: Jory A. Pratt <anarchy@gentoo.org>

set pthread name for non glibc systems

diff --git a/js/src/threading/posix/Thread.cpp b/js/src/threading/posix/Thread.cpp
--- a/js/src/threading/posix/Thread.cpp
+++ b/js/src/threading/posix/Thread.cpp
@@ -155,18 +155,20 @@
   int rv;
 #ifdef XP_DARWIN
   rv = pthread_setname_np(name);
 #elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
   pthread_set_name_np(pthread_self(), name);
   rv = 0;
 #elif defined(__NetBSD__)
   rv = pthread_setname_np(pthread_self(), "%s", (void*)name);
-#else
+#elif defined(__GLIBC__)
   rv = pthread_setname_np(pthread_self(), name);
+#else
+  rv = 0;
 #endif
   MOZ_RELEASE_ASSERT(!rv);
 }
 
 void js::ThisThread::GetName(char* nameBuffer, size_t len) {
   MOZ_RELEASE_ASSERT(len >= 16);
 
   int rv = -1;