Skip to content

Commit 635f6fb

Browse files
author
Trent Mick
committed
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
1 parent b745a04 commit 635f6fb

File tree

6 files changed

+466
-318
lines changed

6 files changed

+466
-318
lines changed

Python/thread_pthread.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
171171
return success != 0 ? 0 : 1;
172172
}
173173

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+
*/
174181
long
175182
PyThread_get_thread_ident(void)
176183
{
@@ -179,7 +186,11 @@ PyThread_get_thread_ident(void)
179186
PyThread_init_thread();
180187
/* Jump through some hoops for Alpha OSF/1 */
181188
threadid = pthread_self();
189+
#if SIZEOF_PTHREAD_T <= SIZEOF_LONG
190+
return (long) threadid;
191+
#else
182192
return (long) *(long *) &threadid;
193+
#endif
183194
}
184195

185196
static void

README

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@ OS/2: If you are running Warp3 or Warp4 and have IBM's VisualAge C/C++
307307
and type NMAKE. Threading and sockets are supported by default
308308
in the resulting binaries of PYTHON15.DLL and PYTHON.EXE.
309309

310+
Monterey (64-bit AIX):
311+
The current Monterey C compiler (Visual Age) uses the OBJECT_MODE={32|64}
312+
environment variable to set the compilation mode to either 32-bit or
313+
64-bit (32-bit mode is the default). Presumably you want 64-bit
314+
compilation mode for this 64-bit OS. As a result you must first set
315+
OBJECT_MODE=64 in you environment before configuring (./configure) or
316+
building (make) Python on Monterey.
317+
310318

311319
Configuring threads
312320
-------------------

acconfig.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@
157157
/* The number of bytes in a time_t. */
158158
#undef SIZEOF_TIME_T
159159

160+
/* The number of bytes in a pthread_t. */
161+
#undef SIZEOF_PTHREAD_T
162+
160163
/* Defined to enable large file support when an off_t is bigger than a long
161164
and long long is available and at least as big as an off_t. You may need
162165
to add some flags for configuration and compilation to enable this mode.

config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@
216216
/* The number of bytes in a time_t. */
217217
#undef SIZEOF_TIME_T
218218

219+
/* The number of bytes in a pthread_t. */
220+
#undef SIZEOF_PTHREAD_T
221+
219222
/* Defined to enable large file support when an off_t is bigger than a long
220223
and long long is available and at least as big as an off_t. You may need
221224
to add some flags for configuration and compilation to enable this mode.

0 commit comments

Comments
 (0)