[PD-dev] stack checking

Thomas Grill gr at grrrr.org
Tue Jun 22 23:40:37 CEST 2004


Hi all,
there has been some interest in the pyext object lately which doesn't work
with vanilla pd very well.
This seems to be because PD's built-in stack checking can't cope with PD
functions called from a different thread.
Following is the diff for *** src/m_obj.c of PD 0.37-1 *** for a different
stack checking approach - it's a simple iteration count which should be far
more portable.
I'm not sure to which value to set the maximum iteration count - it's 1000
for now.
Please note, the devel_0_37 branch already has these changes.

best greetings,
Thomas



11a12,15
> /* T.Grill - define for a modified, more portable method to detect stack
overflows */
> #define NEWSTACKMETH
>
>
258a263,267
> #ifdef NEWSTACKMETH
> /* T.Grill - count iterations rather than watch the stack pointer */
> static int stackcount = 0; /* iteration counter */
> #define STACKITER 1000 /* maximum iterations allowed */
> #else
260a270,271
> #endif
>
265a277
>
267a280
> #ifndef NEWSTACKMETH
270a284
> #endif
312a327
> #ifndef NEWSTACKMETH
313a329
> #endif
319c335,338
< char c;
---
> #ifdef NEWSTACKMETH
> if(++stackcount >= STACKITER)
> #else
> char c;
320a340
> #endif
323a344,346
> #ifdef NEWSTACKMETH
> --stackcount;
> #endif
330c353,356
< char c;
---
> #ifdef NEWSTACKMETH
> if(++stackcount >= STACKITER)
> #else
> char c;
331a358
> #endif
345a373,375
> #ifdef NEWSTACKMETH
> --stackcount;
> #endif
351c381,384
< char c;
---
> #ifdef NEWSTACKMETH
> if(++stackcount >= STACKITER)
> #else
> char c;
352a386
> #endif
355a390,392
> #ifdef NEWSTACKMETH
> --stackcount;
> #endif
361c398,401
< char c;
---
> #ifdef NEWSTACKMETH
> if(++stackcount >= STACKITER)
> #else
> char c;
362a403
> #endif
365a407,409
> #ifdef NEWSTACKMETH
> --stackcount;
> #endif
371c415,418
< char c;
---
> #ifdef NEWSTACKMETH
> if(++stackcount >= STACKITER)
> #else
> char c;
372a420
> #endif
375a424,426
> #ifdef NEWSTACKMETH
> --stackcount;
> #endif
381c432,435
< char c;
---
> #ifdef NEWSTACKMETH
> if(++stackcount >= STACKITER)
> #else
> char c;
382a437
> #endif
385a441,443
> #ifdef NEWSTACKMETH
> --stackcount;
> #endif





More information about the Pd-dev mailing list