From: Vincent Pit Date: Fri, 28 Aug 2009 18:22:32 +0000 (+0200) Subject: Introduce I_FORKSAFE X-Git-Tag: v0.19~1 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=2635de8af7a889878b35ebed184d2f7b3c9c4ac0;p=perl%2Fmodules%2Findirect.git Introduce I_FORKSAFE --- diff --git a/Makefile.PL b/Makefile.PL index b927947..2a617fa 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -11,6 +11,11 @@ if ($^O eq 'MSWin32' && $^V lt v5.9.0) { push @DEFINES, '-DI_MULTIPLICITY=0'; } +# Fork emulation got "fixed" in 5.10.1 +if ($^O eq 'MSWin32' && $^V lt v5.10.1) { + push @DEFINES, '-DI_FORKSAFE=0'; +} + @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES; my $dist = 'indirect'; diff --git a/indirect.xs b/indirect.xs index 3f5a8cc..67eea50 100644 --- a/indirect.xs +++ b/indirect.xs @@ -95,6 +95,11 @@ /* ... Thread safety and multiplicity ...................................... */ +/* Safe unless stated otherwise in Makefile.PL */ +#ifndef I_FORKSAFE +# define I_FORKSAFE 1 +#endif + #ifndef I_MULTIPLICITY # if defined(MULTIPLICITY) || defined(PERL_IMPLICIT_CONTEXT) # define I_MULTIPLICITY 1 @@ -857,6 +862,7 @@ BOOT: stash = gv_stashpvn(__PACKAGE__, __PACKAGE_LEN__, 1); newCONSTSUB(stash, "I_THREADSAFE", newSVuv(I_THREADSAFE)); + newCONSTSUB(stash, "I_FORKSAFE", newSVuv(I_FORKSAFE)); } indirect_setup(); diff --git a/lib/indirect.pm b/lib/indirect.pm index 7c2bab1..34920db 100644 --- a/lib/indirect.pm +++ b/lib/indirect.pm @@ -61,6 +61,7 @@ BEGIN { if ($ENV{PERL_INDIRECT_PM_DISABLE}) { *_tag = sub ($) { 1 }; *I_THREADSAFE = sub () { 1 }; + *I_FORKSAFE = sub () { 1 }; } else { require XSLoader; XSLoader::load(__PACKAGE__, $VERSION); @@ -148,6 +149,11 @@ sub msg { 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 DIAGNOSTICS =head2 C