]> granicus.if.org Git - python/commitdiff
PyOS_CheckStack now understands multiple threads. Other threads are not stack-checked...
authorJack Jansen <jack.jansen@cwi.nl>
Fri, 8 Sep 2000 22:05:48 +0000 (22:05 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Fri, 8 Sep 2000 22:05:48 +0000 (22:05 +0000)
Mac/Python/macglue.c

index 240fc0157a961f2d4b858158c9698a845f32bc7a..67c39186860dbb05780897f99688adf07ff09798 100644 (file)
@@ -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 */