package Thread;
-$VERSION = '2.00';
-
use strict;
-our $ithreads;
-our $othreads;
+our($VERSION, $ithreads, $othreads);
BEGIN {
+ $VERSION = '2.00';
use Config;
$ithreads = $Config{useithreads};
$othreads = $Config{use5005threads};
require Exporter;
use XSLoader ();
-our($VERSION, @ISA, @EXPORT, @EXPORT_OK);
+our(@ISA, @EXPORT, @EXPORT_OK);
@ISA = qw(Exporter);
BEGIN {
if ($ithreads) {
- @EXPORT = qw(share cond_wait cond_broadcast cond_signal unlock)
+ @EXPORT = qw(cond_wait cond_broadcast cond_signal unlock)
} elsif ($othreads) {
@EXPORT_OK = qw(cond_signal cond_broadcast cond_wait);
}
BEGIN {
if ($ithreads) {
+ if ($othreads) {
+ require Carp;
+ Carp::croak("This Perl has both ithreads and 5005threads (serious malconfiguration)");
+ }
XSLoader::load 'threads';
- for my $m (qw(new join detach yield self tid equal)) {
+ for my $m (qw(new join detach yield self tid equal list)) {
no strict 'refs';
*{"Thread::$m"} = \&{"threads::$m"};
}
- XSLoader::load 'threads::shared';
- for my $m (qw(cond_signal cond_broadcast cond_wait unlock share)) {
+ require 'threads/shared.pm';
+ for my $m (qw(cond_signal cond_broadcast cond_wait unlock)) {
no strict 'refs';
*{"Thread::$m"} = \&{"threads::shared::${m}_enabled"};
}
# trying to unimplement eval gives redefined warning
- unimplement(qw(list done flags));
+ unimplement(qw(done flags));
} elsif ($othreads) {
XSLoader::load 'Thread';
unimplement(qw(unlock));
} else {
require Carp;
- Carp::croak("This Perl has neither ithreads not 5005threads");
+ Carp::croak("This Perl has neither ithreads nor 5005threads");
}
}