From: Jerry D. Hedden Date: Mon, 5 Jun 2006 06:34:56 +0000 (-0700) Subject: threads 1.32 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=58a3a76cb3552fafeb21957d1f17da114f2f65ec;p=p5sagit%2Fp5-mst-13.2.git threads 1.32 From: "Jerry D. Hedden" Message-ID: <20060605063456.fb30e530d17747c2b054d625b8945d88.21396dde59.wbe@email.secureserver.net> p4raw-id: //depot/perl@28355 --- diff --git a/MANIFEST b/MANIFEST index 2e9ae71..c4d05eb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1126,7 +1126,8 @@ ext/Thread/README Thread README ext/Thread/README.threads Notes about multithreading ext/threads/Changes ithreads ext/Thread/Semaphore.pmx Threadsafe semaphore -ext/threads/hints/linux.pl thread shared variables +ext/threads/hints/hpux.pl Hint file for HPUX +ext/threads/hints/linux.pl Hint file for Linux ext/threads/Makefile.PL ithreads ext/Thread/specific.tx Test thread-specific user data ext/threads/README ithreads diff --git a/ext/threads/Changes b/ext/threads/Changes index 157c094..b4c9d54 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 f04153d..789411f 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 0000000..0537ed8 --- /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 a4917b0..3b5a1e1 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 8843bdf..fe9ea83 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 32b3f1a..70d4188 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 28d40c8..703ba38 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 d6af217..da50652 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 498e5f1..1f64044 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 20e25c0..5d25db3 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 e7e0c9d..2c24bad 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 747ede7..e5f1449 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 63ad1ac..23bd1bf 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 f72f2a2..806af44 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 threads. Creating threads inside C, C or C 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<-Ekill()> 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 @@ -705,7 +705,7 @@ L Discussion Forum on CPAN: L Annotated POD for L: -L +L L, L diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs index e85c6c7..de571de 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 }