src: Fix setting thread names on macOS.
authorJustus Winter <justus@gnupg.org>
Mon, 10 Oct 2016 08:43:44 +0000 (10:43 +0200)
committerJustus Winter <justus@gnupg.org>
Mon, 10 Oct 2016 09:01:35 +0000 (11:01 +0200)
* src/npth.c (npth_setname_np): Support Apple's one-argument form.

Signed-off-by: Justus Winter <justus@gnupg.org>
src/npth.c

index c647c26..c332338 100644 (file)
@@ -257,8 +257,15 @@ npth_setname_np (npth_t target_thread, const char *name)
 #ifdef __NetBSD__
   return pthread_setname_np (target_thread, "%s", (void*) name);
 #else
+#ifdef __APPLE__
+  if (target_thread == npth_self ())
+    return pthread_setname_np (name);
+  else
+    return ENOTSUP;
+#else
   return pthread_setname_np (target_thread, name);
 #endif
+#endif
 #else
   (void)target_thread;
   (void)name;