From: Peter Sadrozinski Date: Wed, 28 Nov 2012 00:00:00 +0000 (-0500) Subject: SGThread: Add capability to get current thread id X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=35aae588b8f80c500bd41f160f31f9d08b0f7793;p=simgear.git SGThread: Add capability to get current thread id --- diff --git a/simgear/threads/SGThread.cxx b/simgear/threads/SGThread.cxx index 8e5c3a36..b5761215 100644 --- a/simgear/threads/SGThread.cxx +++ b/simgear/threads/SGThread.cxx @@ -81,6 +81,10 @@ struct SGThread::PrivateData { HANDLE _handle; }; +static long SGThread::current( void ) { + return (long)GetCurrentThreadId(); +} + struct SGMutex::PrivateData { PrivateData() { @@ -227,6 +231,10 @@ struct SGThread::PrivateData { bool _started; }; +long SGThread::current( void ) { + return (long)pthread_self(); +} + struct SGMutex::PrivateData { PrivateData() { diff --git a/simgear/threads/SGThread.hxx b/simgear/threads/SGThread.hxx index 7f3a651a..94d5e405 100644 --- a/simgear/threads/SGThread.hxx +++ b/simgear/threads/SGThread.hxx @@ -50,6 +50,11 @@ public: */ void join(); + /** + *Retreive the current thread id. + */ + static long current( void ); + protected: /** * Destroy a thread object.