summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/thread_pthread.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index 2ef46c0..2d6a4f8 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