From 0241aa06d56661cf96cc8490a5b4cb87979cb4db Mon Sep 17 00:00:00 2001 From: Patrick Desaulniers Date: Sat, 11 Nov 2023 08:28:25 -0500 Subject: [PATCH] Don't use std::mutex when compiling with MingW --- src/WolfShaperPlugin.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/WolfShaperPlugin.cpp b/src/WolfShaperPlugin.cpp index 5736686..efff9ae 100644 --- a/src/WolfShaperPlugin.cpp +++ b/src/WolfShaperPlugin.cpp @@ -14,9 +14,14 @@ #include #include #include -#include #include +#ifdef __MINGW32__ +#include "extra/Mutex.hpp" +#else +#include +#endif + #include "Graph.hpp" #include "Mathf.hpp" #include "Oversampler.hpp" @@ -283,7 +288,11 @@ class WolfShaper : public Plugin void setState(const char *key, const char *value) override { +#ifdef __MINGW32__ + const MutexLocker cml(mutex); +#else const std::lock_guard lock(mutex); +#endif if (std::strcmp(key, "graph") == 0) { @@ -369,7 +378,11 @@ class WolfShaper : public Plugin { const ScopedDenormalDisable sdd; +#ifdef __MINGW32__ + const auto lockSucceeded = mutex.tryLock(); +#else const auto lockSucceeded = mutex.try_lock(); +#endif if (lockSucceeded) { @@ -479,7 +492,11 @@ class WolfShaper : public Plugin float inputIndicatorPos; float inputIndicatorAcceleration; +#ifdef __MINGW32__ + Mutex mutex; +#else std::mutex mutex; +#endif float removeDCPrev[2];