From ab433775777c4f5055bcf4d2a1cffc506c4f9961 Mon Sep 17 00:00:00 2001 From: sapier Date: Sat, 25 May 2013 00:51:02 +0200 Subject: Move scriptapi to separate folder (by sapier) On the lua side, notably minetest.env:() should now be replaced by minetest.(). The old way is and will stay supported for a long time. Also: Update and clean up lua_api.txt (by celeron55) Move EnvRef to lua and remove add_rat and add_firefly (by kahrl) Add separate src/util/CMakeLists.txt, other minor fixes (by kahrl) --- src/jthread/jmutex.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/jthread/jmutex.h') 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; }; -- cgit v1.2.3