From 635f6fb0e9fade3c734d650951815682b08bbec2 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Wed, 23 Aug 2000 21:33:05 +0000 Subject: 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 - setting Monterey system name - appropriate CC,LINKCC,LDSHARED,OPT, and CCSHARED for Monterey - Add section in README for Monterey build --- Python/thread_pthread.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Python/thread_pthread.h') diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index 2ef46c0989..2d6a4f8062 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -171,6 +171,13 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) 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_get_thread_ident(void) 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 -- cgit v1.2.1