From: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Tue, 28 Oct 2003 08:48:06 +0000 (+0000)
Subject: Upgrade to Time::HiRes 1.52.
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=690f7c5f9e0ee073c67e83215cf3b54948d9b440;p=p5sagit%2Fp5-mst-13.2.git

Upgrade to Time::HiRes 1.52.

p4raw-id: //depot/perl@21567
---

diff --git a/ext/Time/HiRes/Changes b/ext/Time/HiRes/Changes
index 7c5ae8e..c2bce39 100644
--- a/ext/Time/HiRes/Changes
+++ b/ext/Time/HiRes/Changes
@@ -1,5 +1,10 @@
 Revision history for Perl extension Time::HiRes.
 
+1.52
+	- In AIX (v?) with perl 5.6.1 the HiRes.t can hang after
+	  the subtest 18.  No known analysis nor fix, but added
+	  an alarm (that requires fork() and alarm()) to the test.
+
 1.51
 	- doc tweaks from mjd (perl change #20456)
 	- NCR MP-RAS hints file added (svr4.pl) (perl change #21249)
diff --git a/ext/Time/HiRes/HiRes.pm b/ext/Time/HiRes/HiRes.pm
index 546e381..d04b1a8 100644
--- a/ext/Time/HiRes/HiRes.pm
+++ b/ext/Time/HiRes/HiRes.pm
@@ -15,7 +15,7 @@ require DynaLoader;
 		 d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer
 		 d_nanosleep);
 	
-$VERSION = '1.51';
+$VERSION = '1.52';
 $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
diff --git a/ext/Time/HiRes/Makefile.PL b/ext/Time/HiRes/Makefile.PL
index 04485c7..fc6a155 100644
--- a/ext/Time/HiRes/Makefile.PL
+++ b/ext/Time/HiRes/Makefile.PL
@@ -284,7 +284,7 @@ EOD
     }
 
     if ($has_setitimer && $has_getitimer) {
-	print "You have interval timers (both setitimer and getitimer).\n";
+	print "You have interval timers (both setitimer and setitimer).\n";
     } else {
 	print "You do not have interval timers.\n";
     }
diff --git a/ext/Time/HiRes/t/HiRes.t b/ext/Time/HiRes/t/HiRes.t
index 3afefbe..5e4128e 100644
--- a/ext/Time/HiRes/t/HiRes.t
+++ b/ext/Time/HiRes/t/HiRes.t
@@ -30,6 +30,31 @@ import Time::HiRes 'ualarm'		if $have_ualarm;
 
 use Config;
 
+my $have_alarm = $Config{d_alarm};
+my $have_fork  = $Config{d_fork};
+my $waitfor = 60; # 10 seconds is normal.
+my $pid;
+
+if ($have_fork) {
+    print "# Testing process $$\n";
+    print "# Starting the timer process\n";
+    if (defined ($pid = fork())) {
+	if ($pid == 0) { # We are the kid, set up the timer.
+	    print "# Timer process $$\n";
+	    sleep($waitfor);
+	    warn "$0: Time's up!\n";
+	    print "# Terminating the testing process\n";
+	    kill('TERM', getppid());
+	    print "# Timer process exiting\n";
+	    exit(0);
+	}
+    } else {
+	warn "$0: fork failed: $!\n";
+    }
+} else {
+    print "# No timer process\n";
+}
+
 my $xdefine = ''; 
 
 if (open(XDEFINE, "xdefine")) {
@@ -131,7 +156,7 @@ else {
     ok 11, $f > 0.4 && $f < 0.9, "slept $f instead of 0.5 secs.";
 }
 
-if (!$have_ualarm || !$Config{d_alarm}) {
+if (!$have_ualarm || !$have_alarm) {
     skip 12..13;
 }
 else {
@@ -337,3 +362,9 @@ if ($have_ualarm) {
     skip 24;
     skip 25;
 }
+
+if (defined $pid) {
+    print "# Terminating the timer process $pid\n";
+    kill('TERM', $pid); # We are done, the timer can go.
+}
+