comparison 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
comparison
equal deleted inserted replaced
14143:22b590f8cf53 14144:31cda87e9ff4
169 #endif 169 #endif
170 } 170 }
171 return success != 0 ? 0 : 1; 171 return success != 0 ? 0 : 1;
172 } 172 }
173 173
174 /* XXX This implementation is considered (to quote Tim Peters) "inherently
175 hosed" because:
176 - It does not guanrantee the promise that a non-zero integer is returned.
177 - The cast to long is inherently unsafe.
178 - It is not clear that the 'volatile' (for AIX?) and ugly casting in the
179 latter return statement (for Alpha OSF/1) are any longer necessary.
180 */
174 long 181 long
175 PyThread_get_thread_ident(void) 182 PyThread_get_thread_ident(void)
176 { 183 {
177 volatile pthread_t threadid; 184 volatile pthread_t threadid;
178 if (!initialized) 185 if (!initialized)
179 PyThread_init_thread(); 186 PyThread_init_thread();
180 /* Jump through some hoops for Alpha OSF/1 */ 187 /* Jump through some hoops for Alpha OSF/1 */
181 threadid = pthread_self(); 188 threadid = pthread_self();
189 #if SIZEOF_PTHREAD_T <= SIZEOF_LONG
190 return (long) threadid;
191 #else
182 return (long) *(long *) &threadid; 192 return (long) *(long *) &threadid;
193 #endif
183 } 194 }
184 195
185 static void 196 static void
186 do_PyThread_exit_thread(int no_cleanup) 197 do_PyThread_exit_thread(int no_cleanup)
187 { 198 {