diff options
Diffstat (limited to 'src/threading/mutex.cpp')
-rw-r--r-- | src/threading/mutex.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/threading/mutex.cpp b/src/threading/mutex.cpp index 0908b5d37..d864f12c5 100644 --- a/src/threading/mutex.cpp +++ b/src/threading/mutex.cpp @@ -88,6 +88,15 @@ void Mutex::lock() #endif } +bool Mutex::try_lock() +{ +#if USE_WIN_MUTEX + return TryEnterCriticalSection(&mutex) != 0; +#else + return pthread_mutex_trylock(&mutex) == 0; +#endif +} + void Mutex::unlock() { #if USE_WIN_MUTEX |