Upgrade to Time-HiRes-1.87
authorSteve Peters <steve@fisharerojo.org>
Tue, 14 Feb 2006 17:50:06 +0000 (17:50 +0000)
committerSteve Peters <steve@fisharerojo.org>
Tue, 14 Feb 2006 17:50:06 +0000 (17:50 +0000)
p4raw-id: //depot/perl@27182

ext/Time/HiRes/Changes
ext/Time/HiRes/HiRes.pm
ext/Time/HiRes/t/HiRes.t

index fe9dc3e..0489123 100644 (file)
@@ -1,5 +1,12 @@
 Revision history for Perl extension Time::HiRes.
 
+1.87   [2006-02-13]
+       - [rt.cpan.org #17442] 'make test' frequently fails under
+         Cygwin Perl v5.8.8, reported and patched by J. R. Hedden
+         (two race condition bugs in the END block in the case the
+          main process dies before the timer process, unearthed
+          by a bug in Cygwin ualarm)
+
 1.86   [2005-12-17]
        - HiRes.t:s/ok 32/ok 33/, from Dominic Dunlop
        - tighten up the clock() test marginally by requiring non-negative
index 964e438..564f10e 100644 (file)
@@ -21,7 +21,7 @@ require DynaLoader;
                 d_nanosleep d_clock_gettime d_clock_getres
                 d_clock d_clock_nanosleep);
        
-$VERSION = '1.86';
+$VERSION = '1.87';
 $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
index 0fed572..cae9889 100644 (file)
@@ -74,11 +74,12 @@ if ($have_fork) {
     $timer_pid = fork();
     if (defined $timer_pid) {
        if ($timer_pid == 0) { # We are the kid, set up the timer.
+           my $ppid = getppid();
            print "# I am the timer process $$, sleeping for $waitfor seconds...\n";
            sleep($waitfor);
            warn "\n$0: overall time allowed for tests (${waitfor}s) exceeded!\n";
-           print "# Terminating the main process...\n";
-           kill('TERM', getppid());
+           print "# Terminating main process $ppid...\n";
+           kill('TERM', $ppid);
            print "# This is the timer process $$, over and out.\n";
            exit(0);
        } else {
@@ -588,10 +589,11 @@ if ($have_clock) {
 }
 
 END {
-    if (defined $timer_pid) {
+    if ($timer_pid) { # Only in the main process.
        my $left = $TheEnd - time();
        printf "# I am the main process $$, terminating the timer process $timer_pid\n# before it terminates me in %d seconds (testing took %d seconds).\n", $left, $waitfor - $left;
-       kill('TERM', $timer_pid); # We are done, the timer can go.
+       my $kill = kill('TERM', $timer_pid); # We are done, the timer can go.
+       printf "# kill TERM $timer_pid = %d\n", $kill;
        unlink("ktrace.out"); # Used in BSD system call tracing.
        print "# All done.\n";
     }