summaryrefslogtreecommitdiffstats
path: root/Python/thread_pthread.h
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2006-06-04 23:52:47 (GMT)
committerTim Peters <tim.peters@gmail.com>2006-06-04 23:52:47 (GMT)
commit28eeefe566d77cd3af3d675c4f2216c5033fe538 (patch)
tree7fec63fcf38c5dbe611860fb74e8c49206d2e581 /Python/thread_pthread.h
parentc7d14452a4ed303d38498cc16c3cfc0beed9b843 (diff)
downloadcpython-28eeefe566d77cd3af3d675c4f2216c5033fe538.zip
cpython-28eeefe566d77cd3af3d675c4f2216c5033fe538.tar.gz
cpython-28eeefe566d77cd3af3d675c4f2216c5033fe538.tar.bz2
Revert revisions:
46640 Patch #1454481: Make thread stack size runtime tunable. 46647 Markup fix The first is causing many buildbots to fail test runs, and there are multiple causes with seemingly no immediate prospects for repairing them. See python-dev discussion. Note that a branch can (and should) be created for resolving these problems, like svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH followed by merging rev 46647 to the new branch.
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r--Python/thread_pthread.h63
1 files changed, 2 insertions, 61 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index e2907e0..c29a61c 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -12,24 +12,6 @@
#endif
#include <signal.h>
-/* The POSIX spec requires that use of pthread_attr_setstacksize
- be conditional on _POSIX_THREAD_ATTR_STACKSIZE being defined. */
-#ifdef _POSIX_THREAD_ATTR_STACKSIZE
-#ifndef THREAD_STACK_SIZE
-#define THREAD_STACK_SIZE 0 /* use default stack size */
-#endif
-/* for safety, ensure a viable minimum stacksize */
-#define THREAD_STACK_MIN 0x8000 /* 32kB */
-#if THREAD_STACK_MIN < PTHREAD_STACK_MIN
-#undef THREAD_STACK_MIN
-#define THREAD_STACK_MIN PTHREAD_STACK_MIN
-#endif
-#else /* !_POSIX_THREAD_ATTR_STACKSIZE */
-#ifdef THREAD_STACK_SIZE
-#error "THREAD_STACK_SIZE defined but _POSIX_THREAD_ATTR_STACKSIZE undefined"
-#endif
-#endif
-
/* The POSIX spec says that implementations supporting the sem_*
family of functions must indicate this by defining
_POSIX_SEMAPHORES. */
@@ -156,10 +138,6 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
#if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
pthread_attr_t attrs;
#endif
-#if defined(THREAD_STACK_SIZE)
- size_t tss;
-#endif
-
dprintf(("PyThread_start_new_thread called\n"));
if (!initialized)
PyThread_init_thread();
@@ -167,15 +145,8 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
#if defined(THREAD_STACK_SIZE) || defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
pthread_attr_init(&attrs);
#endif
-#if defined(THREAD_STACK_SIZE)
- tss = (_pythread_stacksize != 0) ? _pythread_stacksize
- : THREAD_STACK_SIZE;
- if (tss != 0) {
- if (pthread_attr_setstacksize(&attrs, tss) != 0) {
- pthread_attr_destroy(&attrs);
- return -1;
- }
- }
+#ifdef THREAD_STACK_SIZE
+ pthread_attr_setstacksize(&attrs, THREAD_STACK_SIZE);
#endif
#if defined(PTHREAD_SYSTEM_SCHED_SUPPORTED)
pthread_attr_setscope(&attrs, PTHREAD_SCOPE_SYSTEM);
@@ -489,33 +460,3 @@ PyThread_release_lock(PyThread_type_lock lock)
}
#endif /* USE_SEMAPHORES */
-
-/* set the thread stack size.
- * Return 1 if an exception is pending, 0 otherwise.
- */
-static int
-_pythread_pthread_set_stacksize(size_t size)
-{
- /* set to default */
- if (size == 0) {
- _pythread_stacksize = 0;
- return 0;
- }
-
- /* valid range? */
- if (size >= THREAD_STACK_MIN) {
- _pythread_stacksize = size;
- return 0;
- }
- else {
- char warning[128];
- snprintf(warning,
- 128,
- "thread stack size of %#x bytes not supported",
- size);
- return PyErr_Warn(PyExc_RuntimeWarning, warning);
- }
-}
-
-#undef THREAD_SET_STACKSIZE
-#define THREAD_SET_STACKSIZE(x) _pythread_pthread_set_stacksize(x)