pthread_getid is only a convience function to convert pthread_t to corresponding thread ID. It is added here to avoid manually casting pthread_t to osv::pthread at other places.
Signed-off-by: Justin Cinkelj <justin.cink...@xlab.si> --- include/api/pthread.h | 2 ++ libc/pthread.cc | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/api/pthread.h b/include/api/pthread.h index 85743f7..ac5e203 100644 --- a/include/api/pthread.h +++ b/include/api/pthread.h @@ -95,6 +95,8 @@ int pthread_getschedparam(pthread_t, int *__restrict, struct sched_param *__rest int pthread_setschedparam(pthread_t, int, const struct sched_param *); int pthread_setschedprio(pthread_t, int); +pid_t pthread_getid(pthread_t); + int pthread_once(pthread_once_t *, void (*)(void)); int pthread_mutex_init(pthread_mutex_t *__restrict, const pthread_mutexattr_t *__restrict); diff --git a/libc/pthread.cc b/libc/pthread.cc index ac7b3f0..dce6375 100644 --- a/libc/pthread.cc +++ b/libc/pthread.cc @@ -258,6 +258,10 @@ extern "C" { __attribute__((alias("pthread_key_create"))); } +pid_t pthread_getid(pthread_t thread) +{ + return pthread::from_libc(thread)->_thread.id(); +} int pthread_key_delete(pthread_key_t key) { -- 2.5.5 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.