Support the NetBSD version of pthread_setname_np
[deliverable/binutils-gdb.git] / gdbsupport / thread-pool.c
index fc83ff765f655baa526f239e4969c7519aff8b28..be9ca22682a0bf59e13bd8bf8098be09cc2487ae 100644 (file)
 #include <pthread.h>
 
 /* Handle platform discrepancies in pthread_setname_np: macOS uses a
-   single-argument form, while Linux uses a two-argument form.  This
-   wrapper handles the difference.  */
+   single-argument form, while Linux uses a two-argument form.  NetBSD
+   takes a printf-style format and an argument.  This wrapper handles the
+   difference.  */
+
+ATTRIBUTE_UNUSED static void
+set_thread_name (int (*set_name) (pthread_t, const char *, void *),
+                                 const char *name)
+{
+  set_name (pthread_self (), "%s", const_cast<char *> (name));
+}
 
 ATTRIBUTE_UNUSED static void
 set_thread_name (int (*set_name) (pthread_t, const char *), const char *name)
This page took 0.022781 seconds and 4 git commands to generate.