Mercurial > cpython-lru_cache-weakref
comparison Python/thread.c @ 38794:f7d23bca599f legacy-trunk
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).
| author | Andrew MacIntyre <andymac@bullseye.apana.org.au> |
|---|---|
| date | Tue, 13 Jun 2006 15:04:24 +0000 |
| parents | c4587a5f5e94 |
| children | 7c09b66f04bd |
comparison
equal
deleted
inserted
replaced
| 38793:992126a29e0f | 38794:f7d23bca599f |
|---|---|
| 93 initialized = 1; | 93 initialized = 1; |
| 94 dprintf(("PyThread_init_thread called\n")); | 94 dprintf(("PyThread_init_thread called\n")); |
| 95 PyThread__init_thread(); | 95 PyThread__init_thread(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 /* Support for runtime thread stack size tuning. | |
| 99 A value of 0 means using the platform's default stack size | |
| 100 or the size specified by the THREAD_STACK_SIZE macro. */ | |
| 101 static size_t _pythread_stacksize = 0; | |
| 102 | |
| 98 #ifdef SGI_THREADS | 103 #ifdef SGI_THREADS |
| 99 #include "thread_sgi.h" | 104 #include "thread_sgi.h" |
| 100 #endif | 105 #endif |
| 101 | 106 |
| 102 #ifdef SOLARIS_THREADS | 107 #ifdef SOLARIS_THREADS |
| 147 /* | 152 /* |
| 148 #ifdef FOOBAR_THREADS | 153 #ifdef FOOBAR_THREADS |
| 149 #include "thread_foobar.h" | 154 #include "thread_foobar.h" |
| 150 #endif | 155 #endif |
| 151 */ | 156 */ |
| 157 | |
| 158 /* return the current thread stack size */ | |
| 159 size_t | |
| 160 PyThread_get_stacksize(void) | |
| 161 { | |
| 162 return _pythread_stacksize; | |
| 163 } | |
| 164 | |
| 165 /* Only platforms defining a THREAD_SET_STACKSIZE() macro | |
| 166 in thread_<platform>.h support changing the stack size. | |
| 167 Return 0 if stack size is valid, | |
| 168 -1 if stack size value is invalid, | |
| 169 -2 if setting stack size is not supported. */ | |
| 170 int | |
| 171 PyThread_set_stacksize(size_t size) | |
| 172 { | |
| 173 #if defined(THREAD_SET_STACKSIZE) | |
| 174 return THREAD_SET_STACKSIZE(size); | |
| 175 #else | |
| 176 return -2; | |
| 177 #endif | |
| 178 } | |
| 152 | 179 |
| 153 #ifndef Py_HAVE_NATIVE_TLS | 180 #ifndef Py_HAVE_NATIVE_TLS |
| 154 /* If the platform has not supplied a platform specific | 181 /* If the platform has not supplied a platform specific |
| 155 TLS implementation, provide our own. | 182 TLS implementation, provide our own. |
| 156 | 183 |
