summaryrefslogtreecommitdiff
path: root/loadbars.pl
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2011-08-05 21:46:36 +0000
committerPaul Buetow <paul@buetow.org>2011-08-05 21:46:36 +0000
commit654a8b2d396573efa842f59aa6f5ae08db9204c1 (patch)
tree6699a85a2097539b16f9ff53005341602f5fcfd2 /loadbars.pl
parent4e95157218d2137df00a76f174c0953b24d026c7 (diff)
Does not hang anymore on quit0.1.3
Diffstat (limited to 'loadbars.pl')
-rwxr-xr-xloadbars.pl11
1 files changed, 4 insertions, 7 deletions
diff --git a/loadbars.pl b/loadbars.pl
index d4b6c88..9de5ff1 100755
--- a/loadbars.pl
+++ b/loadbars.pl
@@ -121,10 +121,10 @@ sub parse_cpu_line ($) {
sub thr_get_stat ($) {
my $host = shift;
- my ($sigusr1, $sigstop) = (0, 0);
+ my $sigusr1 = 0;
my $loadavgexp = qr/(\d+\.\d{2}) (\d+\.\d{2}) (\d+\.\d{2})/;
- do {
+ for (;;) {
my $bash = <<"BASH";
if [ -e /proc/stat ]; then
loadavg=/proc/loadavg
@@ -152,8 +152,7 @@ BASH
say "Terminating get_stat($host) [SSH PID $pid]";
kill 1, $pid;
close $pipe;
-
- $sigstop = 1;
+ threads->exit();
};
# Toggle CPUs
@@ -177,11 +176,9 @@ BASH
$cpuregexp = qr/$CONF{cpuregexp}/;
$sigusr1 = 0;
}
-
- last if $sigstop;
}
- } until $sigstop;
+ }
return undef;
}