Michael Felt <aixto...@felt.demon.nl> added the comment:

Repeating a bot of what I added to PR13463

AIX has native support for thread-id since at least AIX 4.1 (1994-1995) where 
every process has an initial TID (PID are even numbers and "own" the resources, 
TID are odd and are the "workers" - very simply put). Hence, by default, an AIX 
process is "mono-threaded".

The key concern - when calling thread related issues, is to ensure that all 
compiled code uses the same definitions in include files - namely, with 
_THREAD_SAFE defined.

There are couple of ways to accomplish this:
a) ensure that #include <pthread.h> is first (everywhere!)
b) use cc_r, xlc_r, etc_r (with IBM compiler)
c) -D_THREAD_SAFE

As a) seems unpractical to ensure all the time; b) is also unpractical (no idea 
how/if gcc, e.g., has a way to 'signal' the need to be thread_safe - so a 
change in configure.ac, and maybe in setup.py, and thinking further yet - in 
the CFLAGS that get passed to extrnal modules and extensions - adding 
-D_THREAD_SAFE seems the most complete (aka safe) approach.

And, of course, for this specific function a call to

Syntax
#include <pthread.h>
pthread_t pthread_self (void);

Description
The pthread_self subroutine returns the calling thread's ID.

----------
nosy: +Michael.Felt

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36084>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to