summaryrefslogtreecommitdiffstats
path: root/Python/thread_pthread.h
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-08-29 15:24:53 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-08-29 15:24:53 (GMT)
commitc51395d79744a1aeb456d34b9bf5b5ea110ee677 (patch)
tree559a2579ee8c85fd34d93eb684db8d8d2055860f /Python/thread_pthread.h
parentf9dc04341db447bed74e2978f23a1ac5ee906f1e (diff)
downloadcpython-c51395d79744a1aeb456d34b9bf5b5ea110ee677.zip
cpython-c51395d79744a1aeb456d34b9bf5b5ea110ee677.tar.gz
cpython-c51395d79744a1aeb456d34b9bf5b5ea110ee677.tar.bz2
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.
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r--Python/thread_pthread.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index db3115a..6910ccb 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -48,6 +48,13 @@
#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 */
@@ -128,10 +135,17 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
{
pthread_t th;
int success;
+#ifdef THREAD_STACK_SIZE
+ pthread_attr_t attrs;
+#endif
dprintf(("PyThread_start_new_thread called\n"));
if (!initialized)
PyThread_init_thread();
+#ifdef THREAD_STACK_SIZE
+ pthread_attr_init(&attrs);
+ pthread_attr_setstacksize(&attrs, THREAD_STACK_SIZE);
+#endif
success = pthread_create(&th,
#if defined(PY_PTHREAD_D4)
pthread_attr_default,
@@ -146,12 +160,18 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
func,
arg
#elif defined(PY_PTHREAD_STD)
+#ifdef THREAD_STACK_SIZE
+ &attrs,
+#else
(pthread_attr_t*)NULL,
+#endif
(void* (*)(void *))func,
(void *)arg
#endif
);
-
+#ifdef THREAD_STACK_SIZE
+ pthread_attr_destroy(&attrs);
+#endif
if (success == 0) {
#if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D6) || defined(PY_PTHREAD_D7)
pthread_detach(&th);