Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

anyevent::aggressiveidle(3pm) [debian man page]

AnyEvent::AggressiveIdle(3pm)				User Contributed Perl Documentation			     AnyEvent::AggressiveIdle(3pm)

NAME
AnyEvent::AggressiveIdle - Aggressive idle processes for AnyEvent. SYNOPSIS
use AnyEvent::AggressiveIdle qw(aggressive_idle}; aggressive_idle { ... do something important }; my $idle; $idle = aggressive_idle { ... do something important if (FINISH) { undef $idle; # do not call the sub anymore } }; DESCRIPTION
Sometimes You need to do something that takes much time but can be split into elementary phases. If You use AE::idle and Your program is a highload project, idle process can be delayed for much time (second, hour, day, etc). aggressive_idle will be called for each AnyEvent loop cycle. So You can be sure that Your idle process will continue. EXPORTS
aggressive_idle Register Your function as aggressive idle watcher. If it is called in VOID context, the watcher wont be deinstalled. Be carrefully. In NON_VOID context the function returns a guard. Hold the guard until You want to cancel idle process. stop_aggressive_idle You can use the function to stop idle process. The function receives idle process PID that can be received in idle callback (the first argument). Example: use AnyEvent::AggressiveIdle ':all'; # or: use AnyEvent::AggressiveIdle qw(aggressive_idle stop_aggressive_idle); aggressive_idle { my ($pid) = @_; .... stop_aggressive_idle $pid; } The function will throw an exception if invalid PID is received. Continuous process. Sometimes You need to to something continuous inside idle callback. If You want to stop idle calls until You have done Your work, You can hold guard inside Your process: aggressive_idle { my ($pid, $guard) = @_; my $timer; $timer = AE::timer 0.5, 0 => sub { undef $timer; undef $guard; # POINT 1 } } Until 'POINT 1' aggressive_idle won't call its callback. Feel free to stop_aggressive_idle before free the guard. AUTHOR
Dmitry E. Oboukhov, <unera@debian.org> COPYRIGHT AND LICENSE
Copyright (C) 2011 by Dmitry E. Oboukhov This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available. VCS
The project is placed on my GIT repo: <http://git.uvw.ru/?p=anyevent-aggressiveidle;a=summary> perl v5.10.1 2011-03-01 AnyEvent::AggressiveIdle(3pm)

Check Out this Related Man Page

AnyEvent::Impl::EventLib(3pm)				User Contributed Perl Documentation			     AnyEvent::Impl::EventLib(3pm)

NAME
AnyEvent::Impl::EventLib - AnyEvent adaptor for Event::Lib SYNOPSIS
use AnyEvent; use Event::Lib; # this module gets loaded automatically as required DESCRIPTION
This module provides transparent support for AnyEvent. You don't have to do anything to make Event work with AnyEvent except by loading Event::Lib before creating the first AnyEvent watcher. Note: the AnyEvent author has not found recent releases of Event::Lib to be even remotely working (not even the examples from the manpage or the testsuite work), so this event backend should be avoided (or somebody should step up and maintain it, hint, hint). The Event::Lib module suffers from the same limitations and bugs as libevent, most notably it kills already-installed watchers on a file descriptor and it is unable to support fork. These are not fatal issues, and are worked-around by this module, but the Event::Lib perl module itself has many additional bugs such as taking references to file handles and callbacks instead of making a copy or freeing still- allocated scalars, causing memory corruption and random crashes. Only Tk rivals it in its brokenness. This adaptor module employs the same workaround around the watcher problems as Tk and should therefore be avoided. (This was done for simplicity, one could in theory work around the problems with lower overhead by managing our own watchers). Event::Lib also leaks file handles and memory and tends to just exit on problems. It also doesn't work around the Windows bug of not signalling TCP connection failures. It also doesn't work with many special devices on Linux (/dev/random works, /dev/urandom fails, /dev/tty works, /dev/null fails and so on). Event::Lib does not support idle watchers. They could be emulated using low-priority timers but as the priority range (and availability) is not queryable nor guaranteed, and the default priority is likely the lowest one, this module cannot use them. Avoid Event::Lib if you can. SEE ALSO
AnyEvent, Event::Lib. AUTHOR
Marc Lehmann <schmorp@schmorp.de> http://anyevent.schmorp.de perl v5.14.2 2012-04-08 AnyEvent::Impl::EventLib(3pm)
Man Page