ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/State.xs
(Generate patch)

Comparing Coro/Coro/State.xs (file contents):
Revision 1.33 by root, Sun Aug 26 21:44:20 2001 UTC vs.
Revision 1.34 by root, Fri Sep 14 15:40:56 2001 UTC

25 25
26/* The next macro should declare a variable stacklevel that contains and approximation 26/* The next macro should declare a variable stacklevel that contains and approximation
27 * to the current C stack pointer. Its property is that it changes with each call 27 * to the current C stack pointer. Its property is that it changes with each call
28 * and should be unique. */ 28 * and should be unique. */
29#define dSTACKLEVEL void *stacklevel = &stacklevel 29#define dSTACKLEVEL void *stacklevel = &stacklevel
30
31#define IN_DESTRUCT (PL_main_cv == Nullcv)
30 32
31#define labs(l) ((l) >= 0 ? (l) : -(l)) 33#define labs(l) ((l) >= 0 ? (l) : -(l))
32 34
33#include "CoroAPI.h" 35#include "CoroAPI.h"
34 36
487 * still there is a memleak of 128 bytes... 489 * still there is a memleak of 128 bytes...
488 */ 490 */
489STATIC void 491STATIC void
490destroy_stacks(pTHX) 492destroy_stacks(pTHX)
491{ 493{
492 int destruct = PL_main_cv != Nullcv; 494 if (!IN_DESTRUCT)
493
494 if (destruct)
495 { 495 {
496 /* is this ugly, I ask? */ 496 /* is this ugly, I ask? */
497 while (PL_scopestack_ix) 497 while (PL_scopestack_ix)
498 LEAVE; 498 LEAVE;
499 499
513 dSP; 513 dSP;
514 SWITCHSTACK (PL_curstack, PL_curstackinfo->si_stack); 514 SWITCHSTACK (PL_curstack, PL_curstackinfo->si_stack);
515 PUTBACK; /* possibly superfluous */ 515 PUTBACK; /* possibly superfluous */
516 } 516 }
517 517
518 if (destruct) 518 if (!IN_DESTRUCT)
519 { 519 {
520 dounwind(-1); 520 dounwind(-1);
521 SvREFCNT_dec(PL_curstackinfo->si_stack); 521 SvREFCNT_dec(PL_curstackinfo->si_stack);
522 } 522 }
523 523
744 } 744 }
745 } 745 }
746 else 746 else
747 setup_coro (next); 747 setup_coro (next);
748 } 748 }
749 }
750 749
751 /* 750 /*
752 * xnext is now either prev or next, depending on wether 751 * xnext is now either prev or next, depending on wether
753 * we switched the c stack or not. that's why i use a global 752 * we switched the c stack or not. that's why i use a global
754 * variable, that should become thread-specific at one point. 753 * variable, that should become thread-specific at one point.
755 */ 754 */
756 xnext->cursp = stacklevel; 755 xnext->cursp = stacklevel;
756 }
757} 757}
758 758
759static struct coro * 759static struct coro *
760sv_to_coro (SV *arg, const char *funcname, const char *varname) 760sv_to_coro (SV *arg, const char *funcname, const char *varname)
761{ 761{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines