summaryrefslogtreecommitdiff
path: root/src/jthread
diff options
context:
space:
mode:
Diffstat (limited to 'src/jthread')
-rw-r--r--src/jthread/jmutex.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/jthread/jmutex.h b/src/jthread/jmutex.h
index e528aeb4a..383150f3f 100644
--- a/src/jthread/jmutex.h
+++ b/src/jthread/jmutex.h
@@ -57,6 +57,7 @@ public:
int Lock();
int Unlock();
bool IsInitialized() { return initialized; }
+
private:
#if (defined(WIN32) || defined(_WIN32_WCE))
#ifdef JMUTEX_CRITICALSECTION
@@ -66,6 +67,14 @@ private:
#endif // JMUTEX_CRITICALSECTION
#else // pthread mutex
pthread_mutex_t mutex;
+
+ bool IsLocked() {
+ if (pthread_mutex_trylock(&mutex)) {
+ pthread_mutex_unlock(&mutex);
+ return true;
+ }
+ return false;
+ }
#endif // WIN32
bool initialized;
};