From 43e4625bbe4a1ad5fca4cf7d82ccacc9a2dea38e Mon Sep 17 00:00:00 2001 From: Gleb Popov <6yearold@gmail.com> Date: Thu, 1 Jul 2021 15:48:01 +0300 Subject: [PATCH] Use real pthread_setname_np implementation on old FreeBSD. pthread_setname_np differs from pthread_set_name_np in the return value, so it is not correct to just #define one to another. --- src/pipewire/thread-loop.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pipewire/thread-loop.c b/src/pipewire/thread-loop.c index d62a39780..c4bc95c24 100644 --- a/src/pipewire/thread-loop.c +++ b/src/pipewire/thread-loop.c @@ -37,8 +37,14 @@ #define pw_thread_loop_events_destroy(o) pw_thread_loop_events_emit(o, destroy, 0) #ifdef __FreeBSD__ -#include -#define pthread_setname_np pthread_set_name_np +#include +#if __FreeBSD_version < 1202000 +int pthread_setname_np(pthread_t thread, const char *name) +{ + pthread_set_name_np(thread, name); + return 0; +} +#endif #endif /** \cond */