1
0

cIsThread: Added support for getting current thread ID

git-svn-id: http://mc-server.googlecode.com/svn/trunk@288 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-02-18 17:43:20 +00:00
parent 14617868fb
commit d2b229d227
2 changed files with 15 additions and 0 deletions

View File

@ -149,3 +149,16 @@ bool cIsThread::Wait(void)
unsigned long cIsThread::GetCurrentID(void)
{
#ifdef _WIN32
return (unsigned long) GetCurrentThreadId();
#else
return (unsigned long) pthread_self();
#endif
}

View File

@ -37,6 +37,8 @@ public:
bool Start(void); // Starts the thread
bool Wait(void); // Waits for the thread to finish
static unsigned long GetCurrentID(void); // Returns the OS-dependent thread ID for the caller's thread
private:
AString mThreadName;