summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJerry D. Hedden <jdhedden@cpan.org>2006-06-04 23:34:56 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-06-06 11:02:14 +0000
commit58a3a76cb3552fafeb21957d1f17da114f2f65ec (patch)
treefa66d53371177583ca49a86e55ebb6f8f53acaaf /ext
parent09337566c6851d5b25319f9b447a1c2fdeee1b7b (diff)
downloadperl-58a3a76cb3552fafeb21957d1f17da114f2f65ec.tar.gz
threads 1.32
From: "Jerry D. Hedden" <jerry@hedden.us> Message-ID: <20060605063456.fb30e530d17747c2b054d625b8945d88.21396dde59.wbe@email.secureserver.net> p4raw-id: //depot/perl@28355
Diffstat (limited to 'ext')
-rwxr-xr-xext/threads/Changes4
-rwxr-xr-xext/threads/README2
-rw-r--r--ext/threads/hints/hpux.pl10
-rw-r--r--ext/threads/t/blocks.t17
-rw-r--r--ext/threads/t/context.t10
-rw-r--r--ext/threads/t/end.t10
-rw-r--r--ext/threads/t/free.t10
-rw-r--r--ext/threads/t/free2.t10
-rw-r--r--ext/threads/t/join.t10
-rw-r--r--ext/threads/t/kill.t10
-rw-r--r--ext/threads/t/libc.t13
-rw-r--r--ext/threads/t/problems.t13
-rw-r--r--ext/threads/t/thread.t13
-rwxr-xr-xext/threads/threads.pm12
-rwxr-xr-xext/threads/threads.xs9
15 files changed, 126 insertions, 27 deletions
diff --git a/ext/threads/Changes b/ext/threads/Changes
index 157c094a1c..b4c9d5424a 100755
--- a/ext/threads/Changes
+++ b/ext/threads/Changes
@@ -1,5 +1,9 @@
Revision history for Perl extension threads.
+1.32 Mon Jun 5 09:27:53 EDT 2006
+ - Fix for HP-UX 10.20 pthread_attr_getstacksize usage
+ - Check for threads::shared in tests
+
1.31 Fri May 19 16:06:42 EDT 2006
- Explicit thread context
diff --git a/ext/threads/README b/ext/threads/README
index f04153de70..789411f1bb 100755
--- a/ext/threads/README
+++ b/ext/threads/README
@@ -1,4 +1,4 @@
-threads version 1.31
+threads version 1.32
====================
This module needs perl 5.8.0 or later compiled with 'useithreads'.
diff --git a/ext/threads/hints/hpux.pl b/ext/threads/hints/hpux.pl
new file mode 100644
index 0000000000..0537ed810d
--- /dev/null
+++ b/ext/threads/hints/hpux.pl
@@ -0,0 +1,10 @@
+# HP-UX 10.20 has different form for pthread_attr_getstacksize
+my $ver = `uname -r`;
+$ver =~ s/^\D*//;
+if ($ver =~ /^10.20/) {
+ if (exists($self->{'DEFINE'})) {
+ $self->{'DEFINE'} .= " -DHPUX1020";
+ } else {
+ $self->{'DEFINE'} = "-DHPUX1020";
+ }
+}
diff --git a/ext/threads/t/blocks.t b/ext/threads/t/blocks.t
index a4917b0b99..3b5a1e1e8f 100644
--- a/ext/threads/t/blocks.t
+++ b/ext/threads/t/blocks.t
@@ -16,17 +16,24 @@ BEGIN {
use ExtUtils::testlib;
use threads;
-use threads::shared;
-my $TEST;
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
$| = 1;
print("1..5\n"); ### Number of tests that will be run ###
-
- share($TEST);
- $TEST = 1;
};
+my $TEST = 1;
+share($TEST);
+
ok(1, 'Loaded');
sub ok {
diff --git a/ext/threads/t/context.t b/ext/threads/t/context.t
index 8843bdf943..fe9ea830a4 100644
--- a/ext/threads/t/context.t
+++ b/ext/threads/t/context.t
@@ -16,9 +16,17 @@ BEGIN {
use ExtUtils::testlib;
use threads;
-use threads::shared;
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
$| = 1;
print("1..13\n"); ### Number of tests that will be run ###
};
diff --git a/ext/threads/t/end.t b/ext/threads/t/end.t
index 32b3f1a693..70d4188677 100644
--- a/ext/threads/t/end.t
+++ b/ext/threads/t/end.t
@@ -16,9 +16,17 @@ BEGIN {
use ExtUtils::testlib;
use threads;
-use threads::shared;
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
$| = 1;
print("1..6\n"); ### Number of tests that will be run ###
};
diff --git a/ext/threads/t/free.t b/ext/threads/t/free.t
index 28d40c89e4..703ba3896f 100644
--- a/ext/threads/t/free.t
+++ b/ext/threads/t/free.t
@@ -16,9 +16,17 @@ BEGIN {
use ExtUtils::testlib;
use threads;
-use threads::shared;
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
$| = 1;
print("1..29\n"); ### Number of tests that will be run ###
};
diff --git a/ext/threads/t/free2.t b/ext/threads/t/free2.t
index d6af217dd5..da506521f4 100644
--- a/ext/threads/t/free2.t
+++ b/ext/threads/t/free2.t
@@ -16,9 +16,17 @@ BEGIN {
use ExtUtils::testlib;
use threads;
-use threads::shared;
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
if (($] < 5.008002) && ($threads::shared::VERSION < 0.92)) {
print("1..0 # Skip: Needs threads::shared 0.92 or later\n");
exit(0);
diff --git a/ext/threads/t/join.t b/ext/threads/t/join.t
index 498e5f1025..1f640442d5 100644
--- a/ext/threads/t/join.t
+++ b/ext/threads/t/join.t
@@ -16,9 +16,17 @@ BEGIN {
use ExtUtils::testlib;
use threads;
-use threads::shared;
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
$| = 1;
print("1..17\n"); ### Number of tests that will be run ###
};
diff --git a/ext/threads/t/kill.t b/ext/threads/t/kill.t
index 20e25c064f..5d25db34aa 100644
--- a/ext/threads/t/kill.t
+++ b/ext/threads/t/kill.t
@@ -16,9 +16,17 @@ BEGIN {
use ExtUtils::testlib;
use threads;
-use threads::shared;
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
local $SIG{'HUP'} = sub {};
my $thr = threads->create(sub {});
eval { $thr->kill('HUP') };
diff --git a/ext/threads/t/libc.t b/ext/threads/t/libc.t
index e7e0c9d530..2c24bad1ad 100644
--- a/ext/threads/t/libc.t
+++ b/ext/threads/t/libc.t
@@ -29,13 +29,22 @@ sub ok {
return ($ok);
}
+use threads;
+
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
$| = 1;
print("1..12\n"); ### Number of tests that will be run ###
};
-use threads;
-use threads::shared;
ok(1, 1, 'Loaded');
### Start of Testing ###
diff --git a/ext/threads/t/problems.t b/ext/threads/t/problems.t
index 747ede7234..e5f14493b1 100644
--- a/ext/threads/t/problems.t
+++ b/ext/threads/t/problems.t
@@ -15,7 +15,18 @@ BEGIN {
use ExtUtils::testlib;
+use threads;
+
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
$| = 1;
if ($] == 5.008) {
print("1..11\n"); ### Number of tests that will be run ###
@@ -24,8 +35,6 @@ BEGIN {
}
};
-use threads;
-use threads::shared;
print("ok 1 - Loaded\n");
### Start of Testing ###
diff --git a/ext/threads/t/thread.t b/ext/threads/t/thread.t
index 63ad1ac95d..23bd1bff9d 100644
--- a/ext/threads/t/thread.t
+++ b/ext/threads/t/thread.t
@@ -17,13 +17,22 @@ BEGIN {
use ExtUtils::testlib;
+use threads;
+
BEGIN {
+ eval {
+ require threads::shared;
+ import threads::shared;
+ };
+ if ($@ || ! $threads::shared::threads_shared) {
+ print("1..0 # Skip: threads::shared not available\n");
+ exit(0);
+ }
+
$| = 1;
print("1..31\n"); ### Number of tests that will be run ###
};
-use threads;
-use threads::shared;
print("ok 1 - Loaded\n");
### Start of Testing ###
diff --git a/ext/threads/threads.pm b/ext/threads/threads.pm
index f72f2a2a3a..806af441e2 100755
--- a/ext/threads/threads.pm
+++ b/ext/threads/threads.pm
@@ -5,7 +5,7 @@ use 5.008;
use strict;
use warnings;
-our $VERSION = '1.31';
+our $VERSION = '1.32';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
@@ -102,7 +102,7 @@ threads - Perl interpreter-based threads
=head1 VERSION
-This document describes threads version 1.31
+This document describes threads version 1.32
=head1 SYNOPSIS
@@ -648,7 +648,7 @@ there are still existing I<child> threads.
Creating threads inside C<BEGIN>, C<CHECK> or C<INIT> blocks should not be
relied upon. Depending on the Perl version and the application code, results
-may range from success, to (apparently harmless) warnings of leaked scalar,
+may range from success, to (apparently harmless) warnings of leaked scalar, or
all the way up to crashing of the Perl interpreter.
=item Unsafe signals
@@ -678,8 +678,8 @@ the C<-E<gt>kill()> signalling method cannot be used.
Returning closures from threads should not be relied upon. Depending of the
Perl version and the application code, results may range from success, to
-(apparently harmless) warnings of leaked scalar, all the way up to crashing of
-the Perl interpreter.
+(apparently harmless) warnings of leaked scalar, or all the way up to crashing
+of the Perl interpreter.
=item Perl Bugs and the CPAN Version of L<threads>
@@ -705,7 +705,7 @@ L<threads> Discussion Forum on CPAN:
L<http://www.cpanforum.com/dist/threads>
Annotated POD for L<threads>:
-L<http://annocpan.org/~JDHEDDEN/threads-1.31/shared.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-1.32/shared.pm>
L<threads::shared>, L<perlthrtut>
diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs
index e85c6c7327..de571de784 100755
--- a/ext/threads/threads.xs
+++ b/ext/threads/threads.xs
@@ -620,11 +620,14 @@ S_ithread_create(
/* Try to get thread's actual stack size */
{
size_t stacksize;
- if (! pthread_attr_getstacksize(&attr, &stacksize)) {
- if (stacksize) {
+#ifdef HPUX1020
+ stacksize = pthread_attr_getstacksize(attr);
+#else
+ if (! pthread_attr_getstacksize(&attr, &stacksize))
+#endif
+ if (stacksize > 0) {
thread->stack_size = (IV)stacksize;
}
- }
}
# endif
}