From: Vincent Pit Date: Mon, 3 Jan 2011 14:25:13 +0000 (+0100) Subject: Introduce LT_FORKSAFE X-Git-Tag: v0.10~6 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLexical-Types.git;a=commitdiff_plain;h=40ef72f0c01074b9767916dee4cb8eb478929e6f Introduce LT_FORKSAFE --- diff --git a/Makefile.PL b/Makefile.PL index 2f43918..8a8a746 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -11,6 +11,11 @@ if ($^O eq 'MSWin32' && $^V lt v5.9.0) { push @DEFINES, '-DLT_MULTIPLICITY=0'; } +# Fork emulation got "fixed" in 5.10.1 +if ($^O eq 'MSWin32' && $^V lt v5.10.1) { + push @DEFINES, '-DLT_FORKSAFE=0'; +} + @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES; my $dist = 'Lexical-Types'; diff --git a/Types.xs b/Types.xs index 27d5d43..cf005cd 100644 --- a/Types.xs +++ b/Types.xs @@ -45,6 +45,11 @@ /* ... Thread safety and multiplicity ...................................... */ +/* Safe unless stated otherwise in Makefile.PL */ +#ifndef LT_FORKSAFE +# define LT_FORKSAFE 1 +#endif + #ifndef LT_MULTIPLICITY # if defined(MULTIPLICITY) || defined(PERL_IMPLICIT_CONTEXT) # define LT_MULTIPLICITY 1 @@ -833,6 +838,7 @@ BOOT: stash = gv_stashpvn(__PACKAGE__, __PACKAGE_LEN__, 1); newCONSTSUB(stash, "LT_THREADSAFE", newSVuv(LT_THREADSAFE)); + newCONSTSUB(stash, "LT_FORKSAFE", newSVuv(LT_FORKSAFE)); } lt_setup(); diff --git a/lib/Lexical/Types.pm b/lib/Lexical/Types.pm index 026596f..ab54c25 100644 --- a/lib/Lexical/Types.pm +++ b/lib/Lexical/Types.pm @@ -250,6 +250,11 @@ If you prefer to use constants rather than creating empty packages, you can repl True iff the module could have been built with thread-safety features enabled. +=head2 C + +True iff this module could have been built with fork-safety features enabled. +This will always be true except on Windows where it's false for perl 5.10.0 and below . + =head1 CAVEATS The restrictions on the type (being either a defined package name or a constant) apply even if you use the C<'as'> option to redirect to another package, and are unlikely to find a workaround as this happens deep inside the lexer - far from the reach of an extension.