diff --git a/Core/src/Thread.h b/Core/src/Thread.h index 3ec68c6..392f43e 100644 --- a/Core/src/Thread.h +++ b/Core/src/Thread.h @@ -118,6 +118,7 @@ class TCThread : public TCThreadBase { TCThread(TCCallable &); static void Yield(); + static uint64 ThreadID(); void Join(); }; diff --git a/Core/src/ThreadBoost.cpp b/Core/src/ThreadBoost.cpp index 531e63a..9aa0b7f 100644 --- a/Core/src/ThreadBoost.cpp +++ b/Core/src/ThreadBoost.cpp @@ -103,6 +103,15 @@ void TCThread::Yield() { boost::thread::yield(); } +uint64 TCThread::ThreadID() { + boost::thread::id thisID = boost::this_thread::get_id(); + std::stringstream ss; + ss << thisID; + uint64 retID; + ss >> retID; + return retID; +} + //////////////////////////////////////////////////////////////////////////////// // // Mutex Implementation diff --git a/Core/src/ThreadPThread.cpp b/Core/src/ThreadPThread.cpp index d52cb72..f4579ce 100644 --- a/Core/src/ThreadPThread.cpp +++ b/Core/src/ThreadPThread.cpp @@ -134,6 +134,10 @@ void TCThread::Yield() { } } +uint64 TCThread::ThreadID() { + return static_cast(pthread_self()); +} + //////////////////////////////////////////////////////////////////////////////// // // Mutex Implementation