X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Cleanup.xs;h=f41b2c865dc029904c2bf5d7c4f9badb1302f1f9;hb=22959c257e28ede6726925b5098404585a8bac40;hp=34296e1d22116b68b21ade2426941dc496510255;hpb=15b9171b2fc61b12e0dcc123369fc2b66fe87012;p=perl%2Fmodules%2FThread-Cleanup.git diff --git a/Cleanup.xs b/Cleanup.xs index 34296e1..f41b2c8 100644 --- a/Cleanup.xs +++ b/Cleanup.xs @@ -1,5 +1,5 @@ -/* This file is part of the Scope::Upper Perl module. - * See http://search.cpan.org/dist/Scope-Upper/ */ +/* This file is part of the Thread::Cleanup Perl module. + * See http://search.cpan.org/dist/Thread-Cleanup/ */ #define PERL_NO_GET_CONTEXT #include "EXTERN.h" @@ -9,6 +9,22 @@ #define __PACKAGE__ "Thread::Cleanup" #define __PACKAGE_LEN__ (sizeof(__PACKAGE__)-1) +#define TC_HAS_PERL(R, V, S) (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S)))))) + +#undef ENTERn +#if defined(ENTER_with_name) && !TC_HAS_PERL(5, 11, 4) +# define ENTERn(N) ENTER_with_name(N) +#else +# define ENTERn(N) ENTER +#endif + +#undef LEAVEn +#if defined(LEAVE_with_name) && !TC_HAS_PERL(5, 11, 4) +# define LEAVEn(N) LEAVE_with_name(N) +#else +# define LEAVEn(N) LEAVE +#endif + STATIC void tc_callback(pTHX_ void *); STATIC void tc_callback(pTHX_ void *ud) { @@ -31,9 +47,9 @@ STATIC void tc_callback(pTHX_ void *ud) { PUSHMARK(SP); PUTBACK; - call_pv(__PACKAGE__ "::_CLEANUP", G_VOID); + call_pv(__PACKAGE__ "::_CLEANUP", G_VOID | G_EVAL); - SPAGAIN; + PUTBACK; FREETMPS; LEAVE; @@ -52,7 +68,7 @@ CODE: { level = PerlMemShared_malloc(sizeof *level); *level = 1; - LEAVE; + LEAVEn("sub"); SAVEDESTRUCTOR_X(tc_callback, level); - ENTER; + ENTERn("sub"); }