From 13de664ae6a184d15e94c8e373eee166a81ee08c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 30 Jun 2022 17:19:57 +0200 Subject: [PATCH] Provide jack2 compatible implementation for jack1 jack1 (which is Linux only) does not have a jack_client_stop_thread API, and expects the application to call pthread_join(). This fixes an issue when the application is compiled using jack2 headers but the application later runs using jack1's library. --- libs/backends/jack/weak_libjack.def | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/backends/jack/weak_libjack.def b/libs/backends/jack/weak_libjack.def index 52d50f20a5..1d80d07d8c 100644 --- a/libs/backends/jack/weak_libjack.def +++ b/libs/backends/jack/weak_libjack.def @@ -138,7 +138,12 @@ JCFUN(0, int, client_real_time_priority, 0) JCFUN(0, int, client_max_real_time_priority, 0) JPFUN(0, int, acquire_real_time_scheduling, (jack_native_thread_t t, int p), (t,p), 0) JPFUN(0, int, drop_real_time_scheduling, (jack_native_thread_t t), (t), 0) +#if (!defined _WIN32 && (defined _REENTRANT || defined __linux__)) + /* on POSIX systems, call pthread_join() when libjack does not provide jack_client_stop_thread */ +JXFUN(0, int, client_stop_thread, (jack_client_t* c, jack_native_thread_t t), (c,t), if (t) { pthread_join(t, NULL); return 0; } else { return -1;}) +#else JPFUN(0, int, client_stop_thread, (jack_client_t* c, jack_native_thread_t t), (c,t), 0) +#endif JPFUN(0, int, client_kill_thread, (jack_client_t* c, jack_native_thread_t t), (c,t), 0) #ifndef _WIN32 JVFUN(0, set_thread_creator, (jack_thread_creator_t c), (c),)