]> git.mxchange.org Git - simgear.git/commitdiff
SGThread: Add capability to get current thread id
authorPeter Sadrozinski <psadrozinski@gmail.com>
Wed, 28 Nov 2012 00:00:00 +0000 (19:00 -0500)
committerChristian Schmitt <chris@ilovelinux.de>
Wed, 28 Nov 2012 10:23:30 +0000 (11:23 +0100)
simgear/threads/SGThread.cxx
simgear/threads/SGThread.hxx

index 8e5c3a36ac3e69243e8b5f3283aaddbe6db7f03a..b576121526193aad0e9fcc0c751e36c5e5c4da14 100644 (file)
@@ -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()
     {
index 7f3a651a800b195b493c86d676f68a11a1ab7f1b..94d5e40524ab77d9fd2923f22f22a9d5752a0c51 100644 (file)
@@ -50,6 +50,11 @@ public:
      */
     void join();
 
+    /**
+     *Retreive the current thread id.
+     */
+    static long current( void );
+
 protected:
     /**
      * Destroy a thread object.