Instead of having just the application name as thread name, provide a more
descriptive one, which can e.g. read by htop.
If setting the name fails, the thread will still work as intended, just
raise a warning in this case.
Closes #689
Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
THREAD_CFLAGS="-pthread"
LIBS="${LIBS} -pthread"
fi
+ AC_CHECK_FUNCS([pthread_setname_np])
;;
netbsd)
AC_DEFINE([OS_NETBSD], [1], [NetBSD backend])
UNUSED(arg);
+#if defined(HAVE_PTHREAD_SETNAME_NP)
+ r = pthread_setname_np(pthread_self(), "libusb_event");
+ if (r)
+ usbi_warn(NULL, "failed to set hotplug event thread name, error=%d", r);
+#endif
+
usbi_dbg("netlink event thread entering");
while ((r = poll(fds, 2, -1)) >= 0 || errno == EINTR) {
.events = POLLIN},
};
+#if defined(HAVE_PTHREAD_SETNAME_NP)
+ r = pthread_setname_np(pthread_self(), "libusb_event");
+ if (r)
+ usbi_warn(NULL, "failed to set hotplug event thread name, error=%d", r);
+#endif
+
usbi_dbg("udev event thread entering.");
while ((r = poll(fds, 2, -1)) >= 0 || errno == EINTR) {
-#define LIBUSB_NANO 11455
+#define LIBUSB_NANO 11456