Skip to content

Commit

Permalink
Don't use std::mutex when compiling with MingW
Browse files Browse the repository at this point in the history
  • Loading branch information
pdesaulniers committed Nov 11, 2023
1 parent 70ee6d7 commit 0241aa0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/WolfShaperPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <mutex>
#include <sstream>

#ifdef __MINGW32__
#include "extra/Mutex.hpp"
#else
#include <mutex>
#endif

#include "Graph.hpp"
#include "Mathf.hpp"
#include "Oversampler.hpp"
Expand Down Expand Up @@ -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<std::mutex> lock(mutex);
#endif

if (std::strcmp(key, "graph") == 0)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -479,7 +492,11 @@ class WolfShaper : public Plugin
float inputIndicatorPos;
float inputIndicatorAcceleration;

#ifdef __MINGW32__
Mutex mutex;
#else
std::mutex mutex;
#endif

float removeDCPrev[2];

Expand Down

0 comments on commit 0241aa0

Please sign in to comment.