From 77f606cf23a02b7a5b864c38f68af52a47949da4 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 13 Jun 2020 02:03:53 +0100 Subject: [PATCH] libjack: fix under clang and maybe other systems Signed-off-by: falkTX --- source/includes/CarlaLibJackHints.h | 1 + source/libjack/libjack.cpp | 41 ++++++++--------------------- source/libjack/libjack_base.cpp | 23 ++++++++++++++++ 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/source/includes/CarlaLibJackHints.h b/source/includes/CarlaLibJackHints.h index fc1acbf43..71450a833 100644 --- a/source/includes/CarlaLibJackHints.h +++ b/source/includes/CarlaLibJackHints.h @@ -58,6 +58,7 @@ enum InterposerCallbacks { typedef int (*CarlaInterposedCallback)(int, void*); +CARLA_API int jack_carla_interposed_action(uint action, uint value, void* ptr); #ifdef __cplusplus diff --git a/source/libjack/libjack.cpp b/source/libjack/libjack.cpp index 691ec2220..b304defe0 100644 --- a/source/libjack/libjack.cpp +++ b/source/libjack/libjack.cpp @@ -26,27 +26,6 @@ // --------------------------------------------------------------------------------------------------------------------- -CARLA_EXPORT -int jack_carla_interposed_action(uint, uint, void*) -{ - static bool printWarning = true; - - if (printWarning) - { - printWarning = false; - carla_stderr2("Non-exported jack_carla_interposed_action called, this should not happen!!"); - carla_stderr("Printing some info:"); - carla_stderr("\tLD_LIBRARY_PATH: '%s'", std::getenv("LD_LIBRARY_PATH")); - carla_stderr("\tLD_PRELOAD: '%s'", std::getenv("LD_PRELOAD")); - std::fflush(stderr); - } - - // ::kill(::getpid(), SIGKILL); - return 1337; -} - -// --------------------------------------------------------------------------------------------------------------------- - CARLA_BACKEND_START_NAMESPACE // --------------------------------------------------------------------------------------------------------------------- @@ -216,18 +195,20 @@ public: fNonRealtimeThread.stopThread(5000); - const CarlaMutexLocker cms(fRealtimeThreadMutex); - - for (LinkedList::Itenerator it = fClients.begin2(); it.valid(); it.next()) { - JackClientState* const jclient(it.getValue(nullptr)); - CARLA_SAFE_ASSERT_CONTINUE(jclient != nullptr); + const CarlaMutexLocker cms(fRealtimeThreadMutex); - delete jclient; - } + for (LinkedList::Itenerator it = fClients.begin2(); it.valid(); it.next()) + { + JackClientState* const jclient(it.getValue(nullptr)); + CARLA_SAFE_ASSERT_CONTINUE(jclient != nullptr); - fClients.clear(); - fNewClients.clear(); + delete jclient; + } + + fClients.clear(); + fNewClients.clear(); + } clearSharedMemory(); diff --git a/source/libjack/libjack_base.cpp b/source/libjack/libjack_base.cpp index 5efa3be0a..3d6ea7999 100644 --- a/source/libjack/libjack_base.cpp +++ b/source/libjack/libjack_base.cpp @@ -17,6 +17,29 @@ #include "libjack.hpp" +// --------------------------------------------------------------------------------------------------------------------- + +CARLA_EXPORT +int jack_carla_interposed_action(uint, uint, void*) +{ + static bool printWarning = true; + + if (printWarning) + { + printWarning = false; + carla_stderr2("Non-exported jack_carla_interposed_action called, this should not happen!!"); + carla_stderr("Printing some info:"); + carla_stderr("\tLD_LIBRARY_PATH: '%s'", std::getenv("LD_LIBRARY_PATH")); + carla_stderr("\tLD_PRELOAD: '%s'", std::getenv("LD_PRELOAD")); + std::fflush(stderr); + } + + // ::kill(::getpid(), SIGKILL); + return 1337; +} + +// -------------------------------------------------------------------------------------------------------------------- + CARLA_BACKEND_USE_NAMESPACE // --------------------------------------------------------------------------------------------------------------------