diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2000-09-08 22:05:48 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2000-09-08 22:05:48 (GMT) |
commit | 53bafd97d00ef636dfd31525ae8bbcd6e6bc6717 (patch) | |
tree | 687506e1b7fd5ddf6e853a0e28216755af132878 /Mac | |
parent | 90f876798f1ddb2b3005131acb40d17a9e5f8f92 (diff) | |
download | cpython-53bafd97d00ef636dfd31525ae8bbcd6e6bc6717.zip cpython-53bafd97d00ef636dfd31525ae8bbcd6e6bc6717.tar.gz cpython-53bafd97d00ef636dfd31525ae8bbcd6e6bc6717.tar.bz2 |
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.
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Python/macglue.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c index 240fc01..67c3918 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 */ |