From 5b80984e4cb952993cde96d5890ea83087fc8e0d Mon Sep 17 00:00:00 2001 From: Slaven Rezic Date: Sat, 25 Nov 2017 09:57:00 +0100 Subject: [PATCH] timeout on inactivity (RT #123736) --- test.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test.pl b/test.pl index 8436a47..9664e6b 100644 --- a/test.pl +++ b/test.pl @@ -91,9 +91,16 @@ $gc = getGC($win, $font); $x->MapWindow($win); +$SIG{ALRM} = sub { die "Timeout" }; +alarm(30); while (1) { - $x->handle_input until %e = $x->dequeue_event; + eval { $x->handle_input until %e = $x->dequeue_event; }; + if ($@) + { + last if $@ =~ /Timeout/; + die $@; + } if ($e{name} eq "Expose") { next unless $e{count} == 0; -- 2.1.4