From: Vincent Pit Date: Sat, 2 May 2009 14:49:17 +0000 (+0200) Subject: Introduce SU_THREADSAFE X-Git-Tag: v0.09~8 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=0a7ed27cbdbb90c176fc6be11c48e70776c8df84;p=perl%2Fmodules%2FScope-Upper.git Introduce SU_THREADSAFE --- diff --git a/Upper.xs b/Upper.xs index 5e8e8e3..95a22ed 100644 --- a/Upper.xs +++ b/Upper.xs @@ -720,7 +720,8 @@ BOOT: HV *stash; MY_CXT_INIT; stash = gv_stashpv(__PACKAGE__, 1); - newCONSTSUB(stash, "TOP", newSViv(0)); + newCONSTSUB(stash, "TOP", newSViv(0)); + newCONSTSUB(stash, "SU_THREADSAFE", newSVuv(SU_THREADSAFE)); newXSproto("Scope::Upper::unwind", XS_Scope__Upper_unwind, file, NULL); } diff --git a/lib/Scope/Upper.pm b/lib/Scope/Upper.pm index 104674d..1d6b4d1 100644 --- a/lib/Scope/Upper.pm +++ b/lib/Scope/Upper.pm @@ -211,6 +211,12 @@ The previous example can then be "corrected" : will righteously set C<$num> to C<26>. +=head1 CONSTANTS + +=head2 C + +True iff the module could have been built when thread-safety features. + =head1 WORDS =head2 Constants @@ -318,6 +324,8 @@ Where L and L point to depending on the C<$cxt>: The functions L, L, L, L, L and L are only exported on request, either individually or by the tags C<':funcs'> and C<':all'>. +The constant L is also only exported on request, individually or by the tags C<':consts'> and C<':all'>. + Same goes for the words L, L, L, L, L, L and L that are only exported on request, individually or by the tags C<':words'> and C<':all'>. =cut @@ -326,8 +334,9 @@ use base qw/Exporter/; our @EXPORT = (); our %EXPORT_TAGS = ( - funcs => [ qw/reap localize localize_elem localize_delete unwind want_at/ ], - words => [ qw/TOP HERE UP SUB EVAL SCOPE CALLER/ ], + funcs => [ qw/reap localize localize_elem localize_delete unwind want_at/ ], + words => [ qw/TOP HERE UP SUB EVAL SCOPE CALLER/ ], + consts => [ qw/SU_THREADSAFE/ ], ); our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; $EXPORT_TAGS{'all'} = [ @EXPORT_OK ]; diff --git a/t/01-import.t b/t/01-import.t index a0134bb..da61bbc 100644 --- a/t/01-import.t +++ b/t/01-import.t @@ -3,11 +3,13 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 14; require Scope::Upper; -for (qw/reap localize localize_elem localize_delete unwind want_at TOP HERE UP SUB EVAL SCOPE CALLER/) { +for (qw/reap localize localize_elem localize_delete unwind want_at + TOP HERE UP SUB EVAL SCOPE CALLER + SU_THREADSAFE/) { eval { Scope::Upper->import($_) }; is($@, '', 'import ' . $_); }