(retracted by #17321) Make Getopt::Long ithread-safe.
Jarkko Hietaniemi [Thu, 20 Jun 2002 00:23:35 +0000 (00:23 +0000)]
p4raw-id: //depot/perl@17316

lib/Getopt/Long.pm

index 0ab862a..2c3247e 100644 (file)
@@ -132,6 +132,21 @@ ConfigDefaults();
 
 package Getopt::Long::Parser;
 
+# Make Getopt::Long thread-safe for ithreads.
+BEGIN {
+    use Config;
+    if( $] >= 5.008 && $Config{useithreads} ) {
+        require threads;
+        require threads::shared;
+        threads::shared->import;
+        share(\$Getopt::Long::error);
+    }
+    else {
+        *lock = sub { 0 };
+    }
+}
+
+
 # NOTE: The object oriented routines use $error for thread locking.
 my $_lock = sub {
     lock ($Getopt::Long::error) if $] >= 5.005