Add a threadID function

This commit is contained in:
Pavel Krajcevski 2013-09-28 21:42:50 -04:00
parent 13af957ab9
commit 43bd44b6ca
3 changed files with 14 additions and 0 deletions

View file

@ -118,6 +118,7 @@ class TCThread : public TCThreadBase {
TCThread(TCCallable &);
static void Yield();
static uint64 ThreadID();
void Join();
};

View file

@ -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

View file

@ -134,6 +134,10 @@ void TCThread::Yield() {
}
}
uint64 TCThread::ThreadID() {
return static_cast<uint64>(pthread_self());
}
////////////////////////////////////////////////////////////////////////////////
//
// Mutex Implementation