summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-06-20 00:23:35 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-06-20 00:23:35 +0000
commit6d40167621925b3e6ee89773cf75c1bb79880d06 (patch)
tree0e635cf75023b0afcca121dd22d6ed843996aff4 /lib
parenta344be1068c2cd951a34c870c809266dc300b723 (diff)
downloadperl-6d40167621925b3e6ee89773cf75c1bb79880d06.tar.gz
(retracted by #17321) Make Getopt::Long ithread-safe.
p4raw-id: //depot/perl@17316
Diffstat (limited to 'lib')
-rw-r--r--lib/Getopt/Long.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Getopt/Long.pm b/lib/Getopt/Long.pm
index 0ab862a25a..2c3247e729 100644
--- a/lib/Getopt/Long.pm
+++ b/lib/Getopt/Long.pm
@@ -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