Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2008-04-10 09:35:07


Author: anthonyw
Date: 2008-04-10 09:35:07 EDT (Thu, 10 Apr 2008)
New Revision: 44148
URL: http://svn.boost.org/trac/boost/changeset/44148

Log:
Added native_handle to thread on posix platforms
Text files modified:
   trunk/boost/thread/pthread/thread.hpp | 3 +++
   trunk/libs/thread/src/pthread/thread.cpp | 15 +++++++++++++++
   2 files changed, 18 insertions(+), 0 deletions(-)

Modified: trunk/boost/thread/pthread/thread.hpp
==============================================================================
--- trunk/boost/thread/pthread/thread.hpp (original)
+++ trunk/boost/thread/pthread/thread.hpp 2008-04-10 09:35:07 EDT (Thu, 10 Apr 2008)
@@ -214,6 +214,9 @@
         static void sleep(const system_time& xt);
         static void yield();
 
+ typedef pthread_t native_handle_type;
+ native_handle_type native_handle();
+
         // extensions
         void interrupt();
         bool interruption_requested() const;

Modified: trunk/libs/thread/src/pthread/thread.cpp
==============================================================================
--- trunk/libs/thread/src/pthread/thread.cpp (original)
+++ trunk/libs/thread/src/pthread/thread.cpp 2008-04-10 09:35:07 EDT (Thu, 10 Apr 2008)
@@ -472,6 +472,21 @@
             return false;
         }
     }
+
+ thread::native_handle_type thread::native_handle()
+ {
+ detail::thread_data_ptr const local_thread_info=get_thread_info();
+ if(local_thread_info)
+ {
+ lock_guard<mutex> lk(local_thread_info->data_mutex);
+ return local_thread_info->thread_handle;
+ }
+ else
+ {
+ return pthread_t();
+ }
+ }
+
     
 
     namespace this_thread


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk