1Munin::Common::Timeout(U3s)er Contributed Perl DocumentatMiuonnin::Common::Timeout(3)
2
3
4

NAME

6       Munin::Common::Timeout - Run code with a timeout. May nest.
7

SYNOPSIS

9        use Munin::Common::Timeout;
10
11        do_with_timeout(50, sub {
12            # ...
13               do_with_timeout(5, sub {
14                       # ...
15                       # ...
16               });
17            # ...
18        });
19

DESCRIPTION

21       See also Time::Out, Sys::AlarmCall
22

SUBROUTINES

24       do_with_timeout
25            my $finished_with_no_timeout = do_with_timeout($seconds, $code_ref)
26                or die "Timed out!";
27
28           Executes $block with a timeout of $seconds.  Returns the return
29           value of the $block if it completed within the timeout.  If the
30           timeout is reached and the code is still running, it halts it and
31           returns undef.
32
33           NB: every $code_ref should return something defined, otherwise the
34           caller doesn't know if a timeout occurred.
35
36           Calls to do_with_timeout() can be nested.  Any exceptions raised by
37           $block are propagated.
38
39
40
41perl v5.28.2                      2019-05-16         Munin::Common::Timeout(3)
Impressum