I am porting Python to Monterey (64-bit AIX) and have a small (hopefully) question about POSIX threads. I have Monterey building and passing the threads test suite using Python/thread_pthread.h with just one issue: -------------- snipped from current thread_pthread.h --------------- long PyThread_get_thread_ident(void) { volatile pthread_t threadid; if (!initialized) PyThread_init_thread(); /* Jump through some hoops for Alpha OSF/1 */ threadid = pthread_self(); return (long) *(long *) &threadid; } ------------------------------------------------------------------- Does the POSIX threads spec specify a C type or minimum size for pthread_t? Or can someone point me to the appropriate resource to look this up. On Linux (mine at least): /usr/include/bits/pthreadtypes.h:120:typedef unsigned long int pthread_t; On Monterey: typedef unsigned int pthread_t; That is fine, they are both 32-bits, however Monterey is an LP64 platform (sizeof(long)==8, sizeof(int)=4), which brings up the question: WHAT IS UP WITH THAT return STATEMENT? return (long) *(long *) &threadid; My *guess* is that this is an attempt to just cast 'threadid' (a pthread_t) to a long and go through hoops to avoid compiler warnings. I dont' know what else it could be. Is that what the "Alpha OSF/1" comment is about? Anybody have an Alpha OSF/1 hanging around. The problem is that when sizeof(pthread_t) != sizeof(long) this line is just broken. Could this be changed to return threadid; safely? Thanks, Trent -- Trent Mick TrentM@ActiveState.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4