threads 1.32
Jerry D. Hedden [Mon, 5 Jun 2006 06:34:56 +0000 (23:34 -0700)]
From: "Jerry D. Hedden" <jerry@hedden.us>
Message-ID: <20060605063456.fb30e530d17747c2b054d625b8945d88.21396dde59.wbe@email.secureserver.net>

p4raw-id: //depot/perl@28355

16 files changed:
MANIFEST
ext/threads/Changes
ext/threads/README
ext/threads/hints/hpux.pl [new file with mode: 0644]
ext/threads/t/blocks.t
ext/threads/t/context.t
ext/threads/t/end.t
ext/threads/t/free.t
ext/threads/t/free2.t
ext/threads/t/join.t
ext/threads/t/kill.t
ext/threads/t/libc.t
ext/threads/t/problems.t
ext/threads/t/thread.t
ext/threads/threads.pm
ext/threads/threads.xs

index 2e9ae71..c4d05eb 100644 (file)
--- 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
index 157c094..b4c9d54 100755 (executable)
@@ -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
 
index f04153d..789411f 100755 (executable)
@@ -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 (file)
index 0000000..0537ed8
--- /dev/null
@@ -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";
+    }
+}
index a4917b0..3b5a1e1 100644 (file)
@@ -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 {
index 8843bdf..fe9ea83 100644 (file)
@@ -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 ###
 };
index 32b3f1a..70d4188 100644 (file)
@@ -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 ###
 };
index 28d40c8..703ba38 100644 (file)
@@ -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 ###
 };
index d6af217..da50652 100644 (file)
@@ -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);
index 498e5f1..1f64044 100644 (file)
@@ -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 ###
 };
index 20e25c0..5d25db3 100644 (file)
@@ -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') };
index e7e0c9d..2c24bad 100644 (file)
@@ -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 ###
index 747ede7..e5f1449 100644 (file)
@@ -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 ###
index 63ad1ac..23bd1bf 100644 (file)
@@ -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 ###
index f72f2a2..806af44 100755 (executable)
@@ -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>
 
index e85c6c7..de571de 100755 (executable)
@@ -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
     }