1Munin::Common::Timeout(U3s)er Contributed Perl DocumentatMiuonnin::Common::Timeout(3)
2
3
4
6 Munin::Common::Timeout - Run code with a timeout.
7
9 use Munin::Common::Timeout;
10
11 do_with_timeout(5, sub {
12 # ...
13 reset_timout(); # If needed
14 # ...
15 });
16
18 See also Time::Out, Sys::AlarmCall
19
21 do_with_timeout
22 my $finished_with_no_timeout = do_with_timeout($seconds, $block)
23 or die "Timed out!";
24
25 Executes $block with a timeout of $seconds. Returns true if it
26 completed within the timeout. If the timeout is reached and the
27 code is still running, it halts it and returns false.
28
29 Calls to do_with_timeout() can be nested. Any exceptions raised by
30 $block are propagated.
31
32 reset_timeout
33 reset_timeout();
34
35 When called from within $block, resets its timeout to its original
36 value.
37
38
39
40perl v5.12.2 2010-12-05 Munin::Common::Timeout(3)