gh-137884: Added threading.get_native_id() on Illumos/Solaris (GH-137927)

This commit is contained in:
Yüce Tekol 2025-08-20 20:10:44 +03:00 committed by GitHub
parent 3143ceeb1d
commit 7dc42b67a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 3 deletions

View file

@ -30,6 +30,8 @@
# include <lwp.h> /* _lwp_self() */
#elif defined(__DragonFly__)
# include <sys/lwp.h> /* lwp_gettid() */
#elif defined(__sun__) && SIZEOF_LONG >= 8
# include <thread.h>
#endif
/* The POSIX spec requires that use of pthread_attr_setstacksize
@ -399,6 +401,8 @@ PyThread_get_thread_native_id(void)
#elif defined(__DragonFly__)
lwpid_t native_id;
native_id = lwp_gettid();
#elif defined(__sun__) && SIZEOF_LONG >= 8
unsigned long native_id = (unsigned long)getpid() << 32 | thr_self();
#endif
return (unsigned long) native_id;
}