summaryrefslogtreecommitdiffstats
path: root/core/os/condition_variable.h
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2023-11-21 15:44:18 +0100
committerGitHub <noreply@github.com>2023-11-21 15:44:18 +0100
commitc2f8fb301537a5d688d201178985963282b4f9c3 (patch)
tree6e21f7954af3ef36854f53830519c6b6be8c689f /core/os/condition_variable.h
parentfa259a77cd9ea725f22ccfd52d5c228e10358e1d (diff)
parentfe4850c0d0e8eed3fe851007c667206684aab0fc (diff)
downloadredot-engine-c2f8fb301537a5d688d201178985963282b4f9c3.tar.gz
Merge pull request #85039 from RandomShaper/mingwthreads
Use mingw-std-threads in MinGW builds
Diffstat (limited to 'core/os/condition_variable.h')
-rw-r--r--core/os/condition_variable.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/os/condition_variable.h b/core/os/condition_variable.h
index 6037ff327d..6a6996019d 100644
--- a/core/os/condition_variable.h
+++ b/core/os/condition_variable.h
@@ -31,7 +31,14 @@
#ifndef CONDITION_VARIABLE_H
#define CONDITION_VARIABLE_H
+#ifdef MINGW_ENABLED
+#define MINGW_STDTHREAD_REDUNDANCY_WARNING
+#include "thirdparty/mingw-std-threads/mingw.condition_variable.h"
+#define THREADING_NAMESPACE mingw_stdthread
+#else
#include <condition_variable>
+#define THREADING_NAMESPACE std
+#endif
// An object one or multiple threads can wait on a be notified by some other.
// Normally, you want to use a semaphore for such scenarios, but when the
@@ -40,12 +47,12 @@
// own mutex to tie the wait-notify to some other behavior, you need to use this.
class ConditionVariable {
- mutable std::condition_variable condition;
+ mutable THREADING_NAMESPACE::condition_variable condition;
public:
template <class BinaryMutexT>
_ALWAYS_INLINE_ void wait(const MutexLock<BinaryMutexT> &p_lock) const {
- condition.wait(const_cast<std::unique_lock<std::mutex> &>(p_lock.lock));
+ condition.wait(const_cast<THREADING_NAMESPACE::unique_lock<THREADING_NAMESPACE::mutex> &>(p_lock.lock));
}
_ALWAYS_INLINE_ void notify_one() const {