diff options
Diffstat (limited to 'src/jthread')
-rw-r--r-- | src/jthread/jthread.h | 1 | ||||
-rw-r--r-- | src/jthread/pthread/jthread.cpp | 5 | ||||
-rw-r--r-- | src/jthread/win32/jthread.cpp | 5 |
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 |