GUSI on the Mac creates threads with a default stack size of 20KB, which is

not enough for Python. Increased the stacksize to a (somewhat arbitrary)
64KB.
This commit is contained in:
Jack Jansen 2001-08-29 15:24:53 +00:00
parent f9dc04341d
commit c51395d797
1 changed files with 21 additions and 1 deletions

View File

@ -48,6 +48,13 @@
#endif #endif
#ifdef USE_GUSI
/* The Macintosh GUSI I/O library sets the stackspace to
** 20KB, much too low. We up it to 64K.
*/
#define THREAD_STACK_SIZE 0x10000
#endif
/* set default attribute object for different versions */ /* set default attribute object for different versions */
@ -128,10 +135,17 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
{ {
pthread_t th; pthread_t th;
int success; int success;
#ifdef THREAD_STACK_SIZE
pthread_attr_t attrs;
#endif
dprintf(("PyThread_start_new_thread called\n")); dprintf(("PyThread_start_new_thread called\n"));
if (!initialized) if (!initialized)
PyThread_init_thread(); PyThread_init_thread();
#ifdef THREAD_STACK_SIZE
pthread_attr_init(&attrs);
pthread_attr_setstacksize(&attrs, THREAD_STACK_SIZE);
#endif
success = pthread_create(&th, success = pthread_create(&th,
#if defined(PY_PTHREAD_D4) #if defined(PY_PTHREAD_D4)
pthread_attr_default, pthread_attr_default,
@ -146,12 +160,18 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
func, func,
arg arg
#elif defined(PY_PTHREAD_STD) #elif defined(PY_PTHREAD_STD)
#ifdef THREAD_STACK_SIZE
&attrs,
#else
(pthread_attr_t*)NULL, (pthread_attr_t*)NULL,
#endif
(void* (*)(void *))func, (void* (*)(void *))func,
(void *)arg (void *)arg
#endif #endif
); );
#ifdef THREAD_STACK_SIZE
pthread_attr_destroy(&attrs);
#endif
if (success == 0) { if (success == 0) {
#if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7) #if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7)
pthread_detach(&th); pthread_detach(&th);