summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--WISHLIST1
-rwxr-xr-xloadbars.pl52
2 files changed, 27 insertions, 26 deletions
diff --git a/WISHLIST b/WISHLIST
index bc1e2bd..f5ea97d 100644
--- a/WISHLIST
+++ b/WISHLIST
@@ -1,5 +1,4 @@
- Extended text display (hostname, cpu number, etc..)
- Stats for other stuff (e.g. memory, inodes..., disk usage)
BUGS:
-- Program aborts during shutdown process because of the fonts
- Clear screen after 'set scale factor'
diff --git a/loadbars.pl b/loadbars.pl
index b9f16cf..cebce9e 100755
--- a/loadbars.pl
+++ b/loadbars.pl
@@ -297,8 +297,13 @@ sub graph_stats ($) {
my $display_txt = $CONF{toggletxt};
my $display_summary = $CONF{togglesummary};
my $recv_msg = 0;
+ my $sigstop = 0;
+
+ $SIG{STOP} = sub {
+ say "Shutting down display_stats";
+ $sigstop = 1;
+ };
- # Toggle CPUs
$SIG{USR1} = sub { wait_for_stats };
# Set new window dimensions
@@ -320,7 +325,7 @@ sub graph_stats ($) {
my ($t1, $t2) = (Time::HiRes::time(), undef);
- loop {
+ do {
my ($x, $y) = (0, 0);
my $factor = $CONF{factor};
@@ -407,7 +412,8 @@ TIMEKEEPER:
draw_background $app, $rects;
$recv_msg = 0;
}
- };
+
+ } until $sigstop;
return undef;
}
@@ -422,11 +428,6 @@ sub thr_display_stats () {
-resizeable => 0,
);
- $SIG{STOP} = sub {
- say "Shutting down display_stats";
- threads->exit();
- };
-
graph_stats $app
}
@@ -438,23 +439,6 @@ sub send_message ($$) {
$thread->kill('USR2');
}
-sub create_threads (\@) {
- my ($hosts) = @_;
-
- my @threads;
- push @threads, threads->create('thr_get_stat', $_) for @$hosts;
-
- return (threads->create('thr_display_stats'), @threads);
-}
-
-sub stop_threads (@) {
- for (@_) {
- $_->kill('STOP');
- $_->join();
- }
-
- return undef;
-}
sub set_togglecpu_regexp () {
$CONF{cpuregexp} = $CONF{togglecpu} ? 'cpu ' : 'cpu';
@@ -650,6 +634,24 @@ END
return (\$hosts, $closure);
}
+sub create_threads (\@) {
+ my ($hosts) = @_;
+
+ my @threads;
+ push @threads, threads->create('thr_get_stat', $_) for @$hosts;
+
+ return (threads->create('thr_display_stats'), @threads);
+}
+
+sub stop_threads (@) {
+ for (@_) {
+ $_->kill('STOP');
+ $_->join();
+ }
+
+ return undef;
+}
+
sub main () {
my ($hosts, $dispatch) = dispatch_table;
my $help;