]> git.vpit.fr Git - perl/modules/indirect.git/commitdiff
Introduce the I_THREADSAFE() constant
authorVincent Pit <vince@profvince.com>
Sat, 2 May 2009 22:53:08 +0000 (00:53 +0200)
committerVincent Pit <vince@profvince.com>
Sat, 2 May 2009 22:53:08 +0000 (00:53 +0200)
indirect.xs
lib/indirect.pm

index 1e640c8e86953c2b57fccc8b420a459e08e773d3..b19e11a929114d600a0fccb89489799975424e53 100644 (file)
@@ -528,6 +528,7 @@ PROTOTYPES: ENABLE
 BOOT:
 {
  if (!indirect_initialized++) {
+  HV *stash;
 #if I_THREADSAFE
   MY_CXT_INIT;
   MY_CXT.tbl   = ptable_new();
@@ -548,6 +549,9 @@ BOOT:
   PL_check[OP_METHOD]      = MEMBER_TO_FPTR(indirect_ck_method);
   indirect_old_ck_entersub = PL_check[OP_ENTERSUB];
   PL_check[OP_ENTERSUB]    = MEMBER_TO_FPTR(indirect_ck_entersub);
+
+  stash = gv_stashpvn(__PACKAGE__, __PACKAGE_LEN__, 1);
+  newCONSTSUB(stash, "I_THREADSAFE", newSVuv(I_THREADSAFE));
  }
 }
 
index c068be73fa8e42e43bbf961f4343ff698cc3c1ec..4484dae086a7af00d0d8accc3ce0cbd9ac8418a7 100644 (file)
@@ -73,6 +73,12 @@ sub unimport {
  ();
 }
 
+=head1 CONSTANTS
+
+=head2 C<I_THREADSAFE>
+
+True iff the module could have been built when thread-safety features.
+
 =head1 CAVEATS
 
 C<meth $obj> (no semicolon) at the end of a file won't be seen as an indirect object syntax, although it will as soon as there is another token before the end (as in C<meth $obj;> or C<meth $obj 1>).