[FFmpeg-devel] [PATCH] avutil/thread: fix pthread_setname_np parameters for NetBSD and Apple

Marton Balint cus at passwd.hu
Mon Feb 5 01:32:50 EET 2024


Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavutil/thread.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/thread.h b/libavutil/thread.h
index fa74dd2ea7..2c00c7cc35 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -220,7 +220,13 @@ static inline int ff_thread_setname(const char *name)
 #if HAVE_PRCTL
     ret = AVERROR(prctl(PR_SET_NAME, name));
 #elif HAVE_PTHREAD_SETNAME_NP
+#if defined(__APPLE__)
+    ret = AVERROR(pthread_setname_np(name));
+#elif defined(__NetBSD__)
+    ret = AVERROR(pthread_setname_np(pthread_self(), "%s", name));
+#else
     ret = AVERROR(pthread_setname_np(pthread_self(), name));
+#endif
 #elif HAVE_PTHREAD_SET_NAME_NP
     pthread_set_name_np(pthread_self(), name);
 #else
-- 
2.35.3



More information about the ffmpeg-devel mailing list