On Mon, 10 Feb 2003 12:41:57 +0100, [EMAIL PROTECTED] (Angerstein)
wrote:
>If I need an alarm signal alarm(), in less than 1 second what can I do?
Interestingly enough, this just showed up on perlmonks this morning.
http://www.perlmonks.org/index.pl?node_id=23402
Simultaneous alarms under 1 sec
On Feb 10, Angerstein said:
>sub selfalarm {
> $waittime = @_;
Above is your problem. You are assigning the NUMBER of elements in @_ to
$waittime, not the first element. Use one of the following:
my $waittime = shift;
my ($waittime) = @_;
my $waittime = $_[0];
>$ppid = getppid();
>
or what you need.
http://search.cpan.org/author/JHI/Time-HiRes-1.42/HiRes.pm#SYNOPSIS
HTH,
José.
> -Original Message-
> From: Angerstein [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 10, 2003 12:42 PM
> To: Mailinglist Perl Beginners
> Subject: How to alarm under 1 sec
Hello,
I have aquestions.
If I need an alarm signal alarm(), in less than 1 second what can I do?
Would that work?
sub selfalarm {
$waittime = @_;
if ($pid = fork){
} else {
$ppid = getppid();
select (undef,undef,undef, $waittime);
kill 14 => ppid;
}
}
SIG{ALRM} = su