develooper Front page | perl.perl5.porters | Postings from October 2001

[PATCH perl@12718] HiRes.t tweaks

From:
Craig A. Berry
Date:
October 29, 2001 10:33
Subject:
[PATCH perl@12718] HiRes.t tweaks
Message ID:
5.1.0.14.2.20011029121906.035d7e00@exchi01
This patch fixes two problems with the test.  

1.) It was setting $SIG{ALRM} back to its default behavior, but the default 
for ALRM is to kill the process; it was blowing up for me in the middle of 
one of the following tests.  As far as I can tell there is no way to cancel 
an alarm using %SIG, but calling alarm() with an argument of zero seems to 
do the trick.

2.)  It was testing virtual timers without checking for the presence of 
VTALRM, which is not present even on recent versions of VMS.

The test now passes for me on VMS 7.2-1.

--- ext/Time/HiRes/HiRes.t;-0   Fri Oct 26 16:45:08 2001
+++ ext/Time/HiRes/HiRes.t      Mon Oct 29 13:24:50 2001
@@ -180,7 +180,7 @@
        $i--;
        print "# Tick! $i ", Time::HiRes::tv_interval ($r), "\n";
     }
-    $SIG{ALRM} = 'DEFAULT';
+    alarm(0); # can't cancel usig %SIG
 
     print "ok 17\n";
 }
@@ -188,7 +188,8 @@
 unless (defined &Time::HiRes::setitimer
        && defined &Time::HiRes::getitimer
        && exists &Time::HiRes::ITIMER_VIRTUAL
-       && $Config{d_select}) {
+       && $Config{d_select}
+        && ($Config{sig_name} =~ m/\bVTALRM\b/)) {
     for (18..19) {
        print "ok $_ # Skip: no virtual interval timers\n";
     }
[end of patch]

_______________________________________________
Craig A. Berry                                   
mailto:craig.berry@SignalTreeSolutions.com




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About