From: Jack Jansen Date: Fri, 8 Sep 2000 22:05:48 +0000 (+0000) Subject: PyOS_CheckStack now understands multiple threads. Other threads are not stack-checked... X-Git-Tag: v2.0b2~409 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53bafd97d00ef636dfd31525ae8bbcd6e6bc6717;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c index 240fc0157a96..67c39186860d 100644 --- a/Mac/Python/macglue.c +++ b/Mac/Python/macglue.c @@ -412,12 +412,24 @@ PyOS_CheckStack() { 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 */