The added pthread_gettid_np is not portable, and differs even from pthread_getthreadid_np (that one works for current thread only).
Signed-off-by: Justin Cinkelj <[email protected]> --- include/api/pthread.h | 1 + libc/pthread.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/api/pthread.h b/include/api/pthread.h index 105e8d4..1fca154 100644 --- a/include/api/pthread.h +++ b/include/api/pthread.h @@ -217,6 +217,7 @@ int pthread_attr_setaffinity_np(pthread_attr_t *, size_t, const cpu_set_t *); int pthread_attr_getaffinity_np(const pthread_attr_t *, size_t, cpu_set_t *); int pthread_setaffinity_np(pthread_t, size_t, const cpu_set_t *); int pthread_getaffinity_np(pthread_t, size_t, cpu_set_t *); +pid_t pthread_gettid_np(pthread_t); #endif #ifdef __cplusplus diff --git a/libc/pthread.cc b/libc/pthread.cc index 8465a3c..e894146 100644 --- a/libc/pthread.cc +++ b/libc/pthread.cc @@ -975,6 +975,11 @@ int pthread_getname_np(pthread_t p, char* name, size_t namelen) return 0; } +pid_t pthread_gettid_np(pthread_t p) +{ + return pthread::from_libc(p)->_thread->id(); +} + int pthread_attr_setaffinity_np(pthread_attr_t *attr, size_t cpusetsize, const cpu_set_t *cpuset) { -- 2.9.3 -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
