]> git.vpit.fr Git - perl/modules/Variable-Magic.git/commitdiff
Introduce VMG_FORKSAFE
authorVincent Pit <vince@profvince.com>
Tue, 25 Aug 2009 15:04:43 +0000 (17:04 +0200)
committerVincent Pit <vince@profvince.com>
Tue, 25 Aug 2009 15:04:49 +0000 (17:04 +0200)
Magic.xs
Makefile.PL
lib/Variable/Magic.pm
t/01-import.t

index 77b620999cf2a964ad1be719a2f49590701e30ba..1dada023c031867f619d812dc50bdc76facc7a78 100644 (file)
--- a/Magic.xs
+++ b/Magic.xs
 # define dNOOP
 #endif
 
+/* Safe unless stated otherwise in Makefile.PL */
+#ifndef VMG_FORKSAFE
+# define VMG_FORKSAFE 1
+#endif
+
 #ifndef VMG_MULTIPLICITY
 # if defined(MULTIPLICITY) || defined(PERL_IMPLICIT_CONTEXT)
 #  define VMG_MULTIPLICITY 1
@@ -1263,6 +1268,7 @@ BOOT:
                     newSVuv(VMG_COMPAT_SCALAR_LENGTH_NOLEN));
  newCONSTSUB(stash, "VMG_PERL_PATCHLEVEL", newSVuv(VMG_PERL_PATCHLEVEL));
  newCONSTSUB(stash, "VMG_THREADSAFE",      newSVuv(VMG_THREADSAFE));
+ newCONSTSUB(stash, "VMG_FORKSAFE",        newSVuv(VMG_FORKSAFE));
  newCONSTSUB(stash, "VMG_OP_INFO_NAME",    newSVuv(VMG_OP_INFO_NAME));
  newCONSTSUB(stash, "VMG_OP_INFO_OBJECT",  newSVuv(VMG_OP_INFO_OBJECT));
 }
index 5d698c6c7ffdb548c78f2e773eb157137eb7ad01..b3a340e27a9021d3408cf532bb803f3eda21ba0d 100644 (file)
@@ -45,6 +45,11 @@ if ($^O eq 'MSWin32' && $^V lt v5.9.0) {
  push @DEFINES, '-DVMG_MULTIPLICITY=0';
 }
 
+# Fork emulation got "fixed" in 5.10.1
+if ($^O eq 'MSWin32' && $^V lt v5.10.1) {
+ push @DEFINES, '-DVMG_FORKSAFE=0';
+}
+
 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
 
 my $dist = 'Variable-Magic';
index 1ac6898022a72d1c6d27eba58a6e8efc4588049f..954297ea489a64cef8af1fbf72dfe91cde36a583 100644 (file)
@@ -473,6 +473,11 @@ The perl patchlevel this module was built with, or C<0> for non-debugging perls.
 
 True iff this module could have been built with thread-safety features enabled.
 
+=head2 C<VMG_FORKSAFE>
+
+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 .
+
 =head2 C<VMG_OP_INFO_NAME>
 
 Value to pass with C<op_info> to get the current op name in the magic callbacks.
@@ -554,7 +559,7 @@ our %EXPORT_TAGS    = (
                qw/SIG_MIN SIG_MAX SIG_NBR MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR/,
                qw/VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID VMG_COMPAT_ARRAY_UNDEF_CLEAR VMG_COMPAT_SCALAR_LENGTH_NOLEN/,
                qw/VMG_PERL_PATCHLEVEL/,
-               qw/VMG_THREADSAFE/,
+               qw/VMG_THREADSAFE VMG_FORKSAFE/,
                qw/VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/
              ]
 );
index f02df0e122d3c91b0ee46ed36efeb017966c4612..67cf43802fa95efd9bb3d54da04c25405b063c35 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 21;
+use Test::More tests => 22;
 
 require Variable::Magic;
 
@@ -13,7 +13,7 @@ for (qw/wizard gensig getsig cast getdata dispell
         VMG_COMPAT_ARRAY_PUSH_NOLEN  VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID
         VMG_COMPAT_ARRAY_UNDEF_CLEAR VMG_COMPAT_SCALAR_LENGTH_NOLEN
         VMG_PERL_PATCHLEVEL
-        VMG_THREADSAFE
+        VMG_THREADSAFE VMG_FORKSAFE
         VMG_OP_INFO_NAME VMG_OP_INFO_OBJECT/) {
  eval { Variable::Magic->import($_) };
  is($@, '', 'import ' . $_);