GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MUNIN::COMMON::TIMEOUT (3)

.ds Aq ’

NAME

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

CONTENTS

SYNOPSIS



 use Munin::Common::Timeout;

 do_with_timeout(50, sub {
     # ...
        do_with_timeout(5, sub {
                # ...
                # ...
        });
     # ...
 });



DESCRIPTION

See also Time::Out, Sys::AlarmCall

SUBROUTINES

do_with_timeout


 my $finished_with_no_timeout = do_with_timeout($seconds, $code_ref)
     or die "Timed out!";



Executes $block with a timeout of $seconds. Returns the return value of the $block if it completed within the timeout. If the timeout is reached and the code is still running, it halts it and returns undef.

NB: every $code_ref should return something defined, otherwise the caller doesn’t know if a timeout occurred.

Calls to do_with_timeout() can be nested. Any exceptions raised by $block are propagated.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MUNIN::COMMON::TIMEOUT (3) 2016-03-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.