[issue36084] Threading: add builtin TID attribute to Thread objects

Michael Felt report at bugs.python.org
Wed May 22 06:22:26 EDT 2019


Michael Felt <aixtools at felt.demon.nl> added the comment:

I do not know if it is that much mode complex. Unless I missed something it seems to be that this bit - needs three lines added after the FREEBSD block - per below: 
All the other "assurances" are just things that need to be assured. Adding a -D_XXX to CFLAGS is not all that complex either. Perhaps getting the need for the flag documented is 'complex'.

#ifdef PY_HAVE_THREAD_NATIVE_ID
unsigned long
PyThread_get_thread_native_id(void)
{
    if (!initialized)
        PyThread_init_thread();
#ifdef __APPLE__
    uint64_t native_id;
    (void) pthread_threadid_np(NULL, &native_id);
#elif defined(__linux__)
    pid_t native_id;
    native_id = syscall(SYS_gettid);
#elif defined(__FreeBSD__)
    int native_id;
    native_id = pthread_getthreadid_np();
#elif defined(_AIX)
    pthread_t native_id;
    native_id = pthread_self()

****
More may be needed, but I expect it the include file mentioned is already included - but perhaps without the assurance that AIX says it wants/needs for real thread safe builds. And fixing that is just a bonus!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36084>
_______________________________________


More information about the Python-bugs-list mailing list