Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: sleep doesn't respond to sigint(2)?

by JamesNC (Chaplain)
on Oct 17, 2003 at 20:39 UTC ( [id://300148]=note: print w/replies, xml ) Need Help??


in reply to sleep doesn't respond to sigint(2)?

Just use a smaller sleep an count or you you can use select to get a really small wait between looks like so
#!/perl/bin/perl -w use strict; $SIG{'INT'} = 'cleanup'; my $c= 0; while (1) { select(undef, undef, undef, .2); $c++; if($c == 50 ){ #10 seconds print "checking something...\n"; $c= 0; } } sub cleanup {die "\nending\n";}

JamesNC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://300148]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2025-04-20 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.