diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-06-20 00:23:35 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-06-20 00:23:35 +0000 |
commit | 6d40167621925b3e6ee89773cf75c1bb79880d06 (patch) | |
tree | 0e635cf75023b0afcca121dd22d6ed843996aff4 /lib | |
parent | a344be1068c2cd951a34c870c809266dc300b723 (diff) | |
download | perl-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.pm | 15 |
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 |