From dc891760ecf242ed914439666024f236d8f53fad Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 Jul 2018 10:34:54 +0530 Subject: [PATCH] Fix pthread_setname_np on openbsd as well openbsd apparently follows freebsd for this function --- kitty/threading.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/kitty/threading.h b/kitty/threading.h index c1142c2b6..d39ce4837 100644 --- a/kitty/threading.h +++ b/kitty/threading.h @@ -8,10 +8,13 @@ #include #include +#if defined(__FreeBSD__) || defined(__OpenBSD__) +#define FREEBSD_SET_NAME +#endif #if defined(__APPLE__) // I cant figure out how to get pthread.h to include this definition on macOS. MACOSX_DEPLOYMENT_TARGET does not work. extern int pthread_setname_np(const char *name); -#elif defined(__FreeBSD__) +#elif defined(FREEBSD_SET_NAME) // Function has a different name on FreeBSD void pthread_set_name_np(pthread_t tid, const char *name); #else @@ -21,10 +24,10 @@ extern int pthread_setname_np(pthread_t, const char *name); static inline void set_thread_name(const char *name) { - int ret = 0; + int ret; #if defined(__APPLE__) ret = pthread_setname_np(name); -#elif defined(__FreeBSD__) +#elif defined(FREEBSD_SET_NAME) pthread_set_name_np(pthread_self(), name); ret = 0; #else