[haiku-commits] r33927 - in haiku/trunk: headers/os/kernel src/system/libroot/posix/pthread

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 7 Nov 2009 09:19:24 +0100 (CET)

Author: bonefish
Date: 2009-11-07 09:19:24 +0100 (Sat, 07 Nov 2009)
New Revision: 33927
Changeset: http://dev.haiku-os.org/changeset/33927/haiku

Modified:
   haiku/trunk/headers/os/kernel/OS.h
   haiku/trunk/src/system/libroot/posix/pthread/pthread.c
Log:
Added get_pthread_thread_id() function returning the Haiku thread_id of a
pthread.


Modified: haiku/trunk/headers/os/kernel/OS.h
===================================================================
--- haiku/trunk/headers/os/kernel/OS.h  2009-11-06 23:47:53 UTC (rev 33926)
+++ haiku/trunk/headers/os/kernel/OS.h  2009-11-07 08:19:24 UTC (rev 33927)
@@ -7,6 +7,7 @@
 
 //! Kernel specific structures and functions
 
+#include <pthread.h>
 #include <stdarg.h>
 
 #include <SupportDefs.h>
@@ -350,7 +351,14 @@
 #define get_next_thread_info(team, cookie, info) \
        _get_next_thread_info((team), (cookie), (info), sizeof(*(info)))
 
+/* bridge to the pthread API */
+extern thread_id       get_pthread_thread_id(pthread_t thread);
+/* TODO: Would be nice to have, but we use TLS to associate a thread with its
+   pthread object. So this is not trivial to implement.
+extern status_t                convert_to_pthread(thread_id thread, pthread_t 
*_thread);
+*/
 
+
 /* Time */
 
 extern uint32          real_time_clock(void);

Modified: haiku/trunk/src/system/libroot/posix/pthread/pthread.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/pthread/pthread.c      2009-11-06 
23:47:53 UTC (rev 33926)
+++ haiku/trunk/src/system/libroot/posix/pthread/pthread.c      2009-11-07 
08:19:24 UTC (rev 33927)
@@ -232,3 +232,13 @@
        sConcurrencyLevel = newLevel;
        return 0;
 }
+
+
+// #pragma mark - Haiku thread API bridge
+
+
+thread_id
+get_pthread_thread_id(pthread_t thread)
+{
+       return thread->id;
+}


Other related posts:

  • » [haiku-commits] r33927 - in haiku/trunk: headers/os/kernel src/system/libroot/posix/pthread - ingo_weinhold