aboutsummaryrefslogtreecommitdiff
path: root/src/jthread
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2013-06-26 17:19:39 -0400
committerkwolekr <kwolekr@minetest.net>2013-06-27 22:35:35 -0400
commit8aa930f28e69f3518831500022988ca2a4b6985d (patch)
tree5699c9b0cd8eaa54f4fadf8dcd7d0ba98a9c3c74 /src/jthread
parent2c0b51795e6fa6747d881f1871c89830abb6e6e8 (diff)
downloadminetest-8aa930f28e69f3518831500022988ca2a4b6985d.tar.gz
minetest-8aa930f28e69f3518831500022988ca2a4b6985d.tar.bz2
minetest-8aa930f28e69f3518831500022988ca2a4b6985d.zip
Add minetest.get_mapgen_object to API
Diffstat (limited to 'src/jthread')
-rw-r--r--src/jthread/jthread.h1
-rw-r--r--src/jthread/pthread/jthread.cpp5
-rw-r--r--src/jthread/win32/jthread.cpp5
3 files changed, 11 insertions, 0 deletions
diff --git a/src/jthread/jthread.h b/src/jthread/jthread.h
index 9440a158d..cd78231e9 100644
--- a/src/jthread/jthread.h
+++ b/src/jthread/jthread.h
@@ -47,6 +47,7 @@ public:
virtual void *Thread() = 0;
bool IsRunning();
void *GetReturnValue();
+ bool IsSameThread();
protected:
void ThreadStarted();
private:
diff --git a/src/jthread/pthread/jthread.cpp b/src/jthread/pthread/jthread.cpp
index 978cac20a..4a5c736eb 100644
--- a/src/jthread/pthread/jthread.cpp
+++ b/src/jthread/pthread/jthread.cpp
@@ -148,6 +148,11 @@ void *JThread::GetReturnValue()
return val;
}
+bool JThread::IsSameThread()
+{
+ return pthread_equal(pthread_self(), threadid);
+}
+
void *JThread::TheThread(void *param)
{
JThread *jthread;
diff --git a/src/jthread/win32/jthread.cpp b/src/jthread/win32/jthread.cpp
index 54b110bfd..c07425dca 100644
--- a/src/jthread/win32/jthread.cpp
+++ b/src/jthread/win32/jthread.cpp
@@ -141,6 +141,11 @@ void *JThread::GetReturnValue()
return val;
}
+bool JThread::IsSameThread()
+{
+ return GetCurrentThreadId() == threadid;
+}
+
#ifndef _WIN32_WCE
UINT __stdcall JThread::TheThread(void *param)
#else