diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h index f23a86afb0..22647f36d2 100644 --- a/headers/os/kernel/OS.h +++ b/headers/os/kernel/OS.h @@ -7,6 +7,7 @@ //! Kernel specific structures and functions +#include #include #include @@ -350,6 +351,13 @@ extern status_t _get_next_thread_info(team_id team, int32 *cookie, #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 */ diff --git a/src/system/libroot/posix/pthread/pthread.c b/src/system/libroot/posix/pthread/pthread.c index 27f85feb49..5a500c72a6 100644 --- a/src/system/libroot/posix/pthread/pthread.c +++ b/src/system/libroot/posix/pthread/pthread.c @@ -232,3 +232,13 @@ pthread_setconcurrency(int newLevel) sConcurrencyLevel = newLevel; return 0; } + + +// #pragma mark - Haiku thread API bridge + + +thread_id +get_pthread_thread_id(pthread_t thread) +{ + return thread->id; +}