diff options
Diffstat (limited to 'core/os/mutex.cpp')
-rw-r--r-- | core/os/mutex.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/core/os/mutex.cpp b/core/os/mutex.cpp index f099b4319a..31a0dc2bfa 100644 --- a/core/os/mutex.cpp +++ b/core/os/mutex.cpp @@ -30,31 +30,21 @@ #include "mutex.h" -#include "core/error_macros.h" +static Mutex _global_mutex; -#include <stddef.h> - -Mutex *(*Mutex::create_func)(bool) = 0; - -Mutex *Mutex::create(bool p_recursive) { - - ERR_FAIL_COND_V(!create_func, 0); - - return create_func(p_recursive); +void _global_lock() { + _global_mutex.lock(); } -Mutex::~Mutex() { +void _global_unlock() { + _global_mutex.unlock(); } -Mutex *_global_mutex = NULL; +#ifndef NO_THREADS -void _global_lock() { +template class MutexImpl<std::recursive_mutex>; +template class MutexImpl<std::mutex>; +template class MutexLock<MutexImpl<std::recursive_mutex>>; +template class MutexLock<MutexImpl<std::mutex>>; - if (_global_mutex) - _global_mutex->lock(); -} -void _global_unlock() { - - if (_global_mutex) - _global_mutex->unlock(); -} +#endif |