Revision history for Perl extension threads.
+1.42 Mon Sep 18 11:17:13 EDT 2006
+ - Fixes to tests
+ - Move $threads::threads outside of BEGIN block
+
1.41 Fri Sep 8 19:28:41 EST 2006
- Race condition fixes
-threads version 1.41
+threads version 1.42
====================
This module exposes interpreter threads to the Perl level.
my $mutex = 2;
share($mutex);
-sub localtime_r {
- lock($mutex);
- my $retval = localtime(shift());
- return $retval;
-}
-
my @threads;
for (0..$i) {
my $thread = threads->create(sub {
my $error = 0;
for (0..$y) {
my $lt = localtime($arg);
- if($localtime ne $lt) {
+ if ($localtime ne $lt) {
$error++;
}
}
lock($mutex);
+ while ($mutex != ($_ + 2)) {
+ cond_wait($mutex);
+ }
ok($mutex, ! $error, 'localtime safe');
$mutex++;
+ cond_broadcast($mutex);
});
push @threads, $thread;
}
# bugid #24165
-run_perl(prog => 'use threads 1.41;' .
+run_perl(prog => 'use threads 1.42;' .
'sub a{threads->create(shift)} $t = a sub{};' .
'$t->tid; $t->join; $t->tid',
nolib => ($ENV{PERL_CORE}) ? 0 : 1,
use strict;
use warnings;
-our $VERSION = '1.41';
+our $VERSION = '1.42';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
die("This Perl not built to support threads\n");
}
- # Declare that we have been loaded
- $threads::threads = 1;
-
# Complain if 'threads' is loaded after 'threads::shared'
if ($threads::shared::threads_shared) {
warn <<'_MSG_';
}
+# Declare that we have been loaded
+$threads::threads = 1;
+
# Load the XS code
require XSLoader;
XSLoader::load('threads', $XS_VERSION);
=head1 VERSION
-This document describes threads version 1.41
+This document describes threads version 1.42
=head1 SYNOPSIS
L<http://www.cpanforum.com/dist/threads>
Annotated POD for L<threads>:
-L<http://annocpan.org/~JDHEDDEN/threads-1.41/threads.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-1.42/threads.pm>
L<threads::shared>, L<perlthrtut>