From d96179be75ecc344bf71f2d1ffa60f6847d6425e Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sun, 8 Mar 2020 00:06:57 +0100 Subject: Fix mutex when building with no threads. --- core/os/mutex.cpp | 4 ++++ core/os/mutex.h | 26 +++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/core/os/mutex.cpp b/core/os/mutex.cpp index 74c308f646..97297dca28 100644 --- a/core/os/mutex.cpp +++ b/core/os/mutex.cpp @@ -40,7 +40,11 @@ void _global_unlock() { _global_mutex.unlock(); } +#ifndef NO_THREADS + template class MutexImpl; template class MutexImpl; template class MutexLock >; template class MutexLock >; + +#endif diff --git a/core/os/mutex.h b/core/os/mutex.h index 8d7b378d60..9033f0cb06 100644 --- a/core/os/mutex.h +++ b/core/os/mutex.h @@ -71,9 +71,22 @@ public: } }; +using Mutex = MutexImpl; // Recursive, for general use +using BinaryMutex = MutexImpl; // Non-recursive, handle with care + +extern template class MutexImpl; +extern template class MutexImpl; +extern template class MutexLock >; +extern template class MutexLock >; + #else -template +class FakeMutex { + + FakeMutex(){}; +}; + +template class MutexImpl { public: _ALWAYS_INLINE_ void lock() const {} @@ -87,14 +100,9 @@ public: explicit MutexLock(const MutexT &p_mutex) {} }; -#endif // !NO_THREADS - -using Mutex = MutexImpl; // Recursive, for general use -using BinaryMutex = MutexImpl; // Non-recursive, handle with care +using Mutex = MutexImpl; +using BinaryMutex = MutexImpl; // Non-recursive, handle with care -extern template class MutexImpl; -extern template class MutexImpl; -extern template class MutexLock >; -extern template class MutexLock >; +#endif // !NO_THREADS #endif -- cgit v1.2.3