Mercurial > cpython-lru_cache-weakref
diff Mac/Python/macglue.c @ 14476:71456782d8fd legacy-trunk
PyOS_CheckStack now understands multiple threads. Other threads are not stack-checked, but at least they don't appear to always be out of stack.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Fri, 08 Sep 2000 22:05:48 +0000 |
| parents | 2787e93817c6 |
| children | a93d79da4f8c |
line wrap: on
line diff
--- a/Mac/Python/macglue.c Fri Sep 08 21:54:44 2000 +0000 +++ b/Mac/Python/macglue.c Fri Sep 08 22:05:48 2000 +0000 @@ -412,12 +412,24 @@ { char here; static char *sentinel = 0; + static PyThreadState *thread_for_sentinel = 0; if ( sentinel == 0 ) { sentinel = &here - StackSpace() + MINIMUM_STACK_SIZE; } - if ( &here < sentinel ) - return -1; + if ( thread_for_sentinel == 0 ) { + thread_for_sentinel = PyThreadState_Get(); + } + if ( &here < sentinel ) { + if (thread_for_sentinel == PyThreadState_Get()) { + return -1; +#if 0 + } else { + /* Else we are unsure... */ + fprintf(stderr, "Stackcheck in other thread (was %x now %x)\n", thread_for_sentinel,PyThreadState_Get()); +#endif + } + } return 0; } #endif /* USE_STACKCHECK */
