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

Re: [PATCH perl@12696] C RTL awareness update for VMS

Thread Next
From:
lane
Date:
October 27, 2001 19:50
Subject:
Re: [PATCH perl@12696] C RTL awareness update for VMS
Message ID:
011027225324.19ae30@DUPHY4.Physics.Drexel.Edu
"Craig A. Berry" <craigberry@mac.com> writes:
> It turns out there are several functions available in the C library in
> recent versions of VMS that we've been saying we don't have.  After the
> patch below we fail some Time::HiRes tests that we formerly skipped (hope to
> have another patch for those soon) but otherwise this causes us no problems.

For those of us with older versions of VMS, I've cooked up a patch that
implements ualarm with native VMS calls.

But, like Craig, I've seen a lot of test errors appear.  They all seem
to arise from the use of "signal()" and its "one-shot" nature.

So even without Time::HiRes, if we do something like:

    $SIG{ALRM} = sub { print "signal handled!\n"; } ;
    alarm(2);
    sleep(4);       # SIGALRM fires during sleep
    alarm(2);
    sleep(4);       # SIGALRM fires during sleep

on the second SIGALRM, there's an error exit with stack dump because
the SIGALRM isn't caught by the handler ... since we didn't reset
the signal handler after the first signal.

Now a question to the wider Perl community: is that what one should
expect from %SIG?   Should SIG handlers be one-shot, or persistent?

I have the *suspicion* that it is expected that handlers are
persistent, because otherwise the test code in HiRes:

    local $SIG{ALRM} = sub { $tick++ };
    my $one = time; $tick = 0; ualarm(10_000); sleep until $tick;
    my $two = time; $tick = 0; ualarm(10_000); sleep until $tick;

would clearly fail on the second ualarm.  Unfortunately the docs
aren't very clear on this point.

--
 Drexel University       \V                    --Chuck Lane
======]---------->--------*------------<-------[===========
     (215) 895-1545     _/ \  Particle Physics
FAX: (215) 895-5934     /\ /~~~~~~~~~~~        lane@duphy4.physics.drexel.edu

Thread Next


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