S
Sébastien Cottalorda
I need to define an alarm like this.
eval {
my $thr = threads->new(\&run_cmd, params);
};
if ($@){
print "$@\n";
}
blah blah blah
sub run_cmd {
blah blah blah
threads->detach();
eval {
local $SIG{ALRM} = sub { die "TIMEOUT\n" };
alarm 10;
`$command_to_execute`;
alarm 0;
};
if ($@){
print "$@\n";
}
}
My problem is the following :
after waiting 10 seconds, either the master or the thread die.
How can I timeout the thread without affecting the master ?
Thanks in advance for any kind of help.
Sebastien
eval {
my $thr = threads->new(\&run_cmd, params);
};
if ($@){
print "$@\n";
}
blah blah blah
sub run_cmd {
blah blah blah
threads->detach();
eval {
local $SIG{ALRM} = sub { die "TIMEOUT\n" };
alarm 10;
`$command_to_execute`;
alarm 0;
};
if ($@){
print "$@\n";
}
}
My problem is the following :
after waiting 10 seconds, either the master or the thread die.
How can I timeout the thread without affecting the master ?
Thanks in advance for any kind of help.
Sebastien