summaryrefslogtreecommitdiffstats
path: root/Python/thread.c
diff options
context:
space:
mode:
authorAndrew MacIntyre <andymac@bullseye.apana.org.au>2006-06-13 15:04:24 (GMT)
committerAndrew MacIntyre <andymac@bullseye.apana.org.au>2006-06-13 15:04:24 (GMT)
commit9291332de137141057591386b4ba449ae3a5ed48 (patch)
tree31e4a0a2411052ceb8e05284fe9409c6995f79ca /Python/thread.c
parentc6f5b3ad6c9e93235f9aa53d1ed8086030fbcd6c (diff)
downloadcpython-9291332de137141057591386b4ba449ae3a5ed48.zip
cpython-9291332de137141057591386b4ba449ae3a5ed48.tar.gz
cpython-9291332de137141057591386b4ba449ae3a5ed48.tar.bz2
Patch #1454481: Make thread stack size runtime tunable.
Heavily revised, comprising revisions: 46640 - original trunk revision (backed out in r46655) 46647 - markup fix (backed out in r46655) 46692:46918 merged from branch aimacintyre-sf1454481 branch tested on buildbots (Windows buildbots had problems not related to these changes).
Diffstat (limited to 'Python/thread.c')
-rw-r--r--Python/thread.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/Python/thread.c b/Python/thread.c
index c9356dc..bc501822 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -95,6 +95,11 @@ PyThread_init_thread(void)
PyThread__init_thread();
}
+/* Support for runtime thread stack size tuning.
+ A value of 0 means using the platform's default stack size
+ or the size specified by the THREAD_STACK_SIZE macro. */
+static size_t _pythread_stacksize = 0;
+
#ifdef SGI_THREADS
#include "thread_sgi.h"
#endif
@@ -150,6 +155,28 @@ PyThread_init_thread(void)
#endif
*/
+/* return the current thread stack size */
+size_t
+PyThread_get_stacksize(void)
+{
+ return _pythread_stacksize;
+}
+
+/* Only platforms defining a THREAD_SET_STACKSIZE() macro
+ in thread_<platform>.h support changing the stack size.
+ Return 0 if stack size is valid,
+ -1 if stack size value is invalid,
+ -2 if setting stack size is not supported. */
+int
+PyThread_set_stacksize(size_t size)
+{
+#if defined(THREAD_SET_STACKSIZE)
+ return THREAD_SET_STACKSIZE(size);
+#else
+ return -2;
+#endif
+}
+
#ifndef Py_HAVE_NATIVE_TLS
/* If the platform has not supplied a platform specific
TLS implementation, provide our own.