[Python-Dev] Should Python #define _POSIX_THREADS?

Fredrik Lundh fredrik@pythonware.com
Fri, 6 Apr 2001 08:07:41 +0200


thomas wrote:
> Actually, I think the above should go in *before* 2.1 final. It won't break
> anything new, and it fixes some warnings and possible some problems.
> Because:
> 
> - if _POSIX_THREADS is not already defined, nothing changes
> - if _POSIX_THREADS is already defined, to the same value as we are defining
>   it to, nothing changes
> - if _POSIX_THREADS is already defined, but to a different value than Python
>   wants to define it to, it used to break and starts working now. There is
>   nothing that depends on the actual value of _POSIX_THREADS in Python right
>   now (because it doesn't *have* a value.)

on the other hand, cygwin is the only platform that has reported
problems with this, and your solution doesn't address their problem.
(which is that Python assumes that a system that has pthread_create
in a library is a fully compliant POSIX thread system)

the right thing to do appears to be to let configure compile and
link a program that uses *all* pthread features needed, and define
_POSIX_THREAD (or better, PY_POSIX_THREADS) only if that
works...

Cheers /F