hurd: Rather use hurd_thread_self

This avoids a kernel RPC, and fixes port ref leak.
This commit is contained in:
Samuel Thibault 2023-10-08 11:38:59 +02:00 committed by Wim Taymans
parent 4bd1cc8fcd
commit 69baef165c

View file

@ -36,7 +36,7 @@
#include <sys/thr.h> #include <sys/thr.h>
#endif #endif
#if defined(__GNU__) #if defined(__GNU__)
#include <mach.h> #include <hurd.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
@ -225,7 +225,7 @@ static pid_t _gettid(void)
thr_self(&pid); thr_self(&pid);
return (pid_t)pid; return (pid_t)pid;
#elif defined(__GNU__) #elif defined(__GNU__)
mach_port_t thread = mach_thread_self(); mach_port_t thread = hurd_thread_self();
return (pid_t)thread; return (pid_t)thread;
#else #else
#error "No gettid impl" #error "No gettid impl"