Mercurial > cpython-lru_cache-weakref
diff Python/thread_pthread.h @ 14144:31cda87e9ff4 legacy-trunk
This patch partly (some stuff went in already) ports Python to Monterey.
- Fix bug in thread_pthread.h::PyThread_get_thread_ident() where
sizeof(pthread) < sizeof(long).
- Add 'configure' for:
- SIZEOF_PTHREAD is pthread_t can be included via <pthread.h>
- setting Monterey system name
- appropriate CC,LINKCC,LDSHARED,OPT, and CCSHARED for Monterey
- Add section in README for Monterey build
| author | Trent Mick <trentm@activestate.com> |
|---|---|
| date | Wed, 23 Aug 2000 21:33:05 +0000 |
| parents | f79434ee41fa |
| children | 6f6f965c5e2d |
line wrap: on
line diff
--- a/Python/thread_pthread.h Wed Aug 23 21:16:10 2000 +0000 +++ b/Python/thread_pthread.h Wed Aug 23 21:33:05 2000 +0000 @@ -171,6 +171,13 @@ return success != 0 ? 0 : 1; } +/* XXX This implementation is considered (to quote Tim Peters) "inherently + hosed" because: + - It does not guanrantee the promise that a non-zero integer is returned. + - The cast to long is inherently unsafe. + - It is not clear that the 'volatile' (for AIX?) and ugly casting in the + latter return statement (for Alpha OSF/1) are any longer necessary. +*/ long PyThread_get_thread_ident(void) { @@ -179,7 +186,11 @@ PyThread_init_thread(); /* Jump through some hoops for Alpha OSF/1 */ threadid = pthread_self(); +#if SIZEOF_PTHREAD_T <= SIZEOF_LONG + return (long) threadid; +#else return (long) *(long *) &threadid; +#endif } static void
