ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.274 by root, Sun Aug 9 00:20:35 2009 UTC vs.
Revision 1.277 by root, Sun Aug 9 13:27:23 2009 UTC

806=over 4 806=over 4
807 807
808=item Backends that are autoprobed when no other event loop can be found. 808=item Backends that are autoprobed when no other event loop can be found.
809 809
810EV is the preferred backend when no other event loop seems to be in 810EV is the preferred backend when no other event loop seems to be in
811use. If EV is not installed, then AnyEvent will try Event, and, failing 811use. If EV is not installed, then AnyEvent will fall back to its own
812that, will fall back to its own pure-perl implementation, which is 812pure-perl implementation, which is available everywhere as it comes with
813available everywhere as it comes with AnyEvent itself. 813AnyEvent itself.
814 814
815 AnyEvent::Impl::EV based on EV (interface to libev, best choice). 815 AnyEvent::Impl::EV based on EV (interface to libev, best choice).
816 AnyEvent::Impl::Event based on Event, very stable, few glitches.
817 AnyEvent::Impl::Perl pure-perl implementation, fast and portable. 816 AnyEvent::Impl::Perl pure-perl implementation, fast and portable.
818 817
819=item Backends that are transparently being picked up when they are used. 818=item Backends that are transparently being picked up when they are used.
820 819
821These will be used when they are currently loaded when the first watcher 820These will be used when they are currently loaded when the first watcher
822is created, in which case it is assumed that the application is using 821is created, in which case it is assumed that the application is using
823them. This means that AnyEvent will automatically pick the right backend 822them. This means that AnyEvent will automatically pick the right backend
824when the main program loads an event module before anything starts to 823when the main program loads an event module before anything starts to
825create watchers. Nothing special needs to be done by the main program. 824create watchers. Nothing special needs to be done by the main program.
826 825
826 AnyEvent::Impl::Event based on Event, very stable, few glitches.
827 AnyEvent::Impl::Glib based on Glib, slow but very stable. 827 AnyEvent::Impl::Glib based on Glib, slow but very stable.
828 AnyEvent::Impl::Tk based on Tk, very broken. 828 AnyEvent::Impl::Tk based on Tk, very broken.
829 AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse. 829 AnyEvent::Impl::EventLib based on Event::Lib, leaks memory and worse.
830 AnyEvent::Impl::POE based on POE, very slow, some limitations. 830 AnyEvent::Impl::POE based on POE, very slow, some limitations.
831 AnyEvent::Impl::Irssi used when running within irssi. 831 AnyEvent::Impl::Irssi used when running within irssi.
1151 $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6"; 1151 $ENV{PERL_ANYEVENT_PROTOCOLS} || "ipv4,ipv6";
1152} 1152}
1153 1153
1154my @models = ( 1154my @models = (
1155 [EV:: => AnyEvent::Impl::EV:: , 1], 1155 [EV:: => AnyEvent::Impl::EV:: , 1],
1156 [Event:: => AnyEvent::Impl::Event::, 1],
1157 [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl:: , 1], 1156 [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl:: , 1],
1158 # everything below here will not (normally) be autoprobed 1157 # everything below here will not (normally) be autoprobed
1159 # as the pureperl backend should work everywhere 1158 # as the pureperl backend should work everywhere
1160 # and is usually faster 1159 # and is usually faster
1160 [Event:: => AnyEvent::Impl::Event::, 1],
1161 [Glib:: => AnyEvent::Impl::Glib:: , 1], # becomes extremely slow with many watchers 1161 [Glib:: => AnyEvent::Impl::Glib:: , 1], # becomes extremely slow with many watchers
1162 [Event::Lib:: => AnyEvent::Impl::EventLib::], # too buggy 1162 [Event::Lib:: => AnyEvent::Impl::EventLib::], # too buggy
1163 [Irssi:: => AnyEvent::Impl::Irssi::], # Irssi has a bogus "Event" package 1163 [Irssi:: => AnyEvent::Impl::Irssi::], # Irssi has a bogus "Event" package
1164 [Tk:: => AnyEvent::Impl::Tk::], # crashes with many handles 1164 [Tk:: => AnyEvent::Impl::Tk::], # crashes with many handles
1165 [Qt:: => AnyEvent::Impl::Qt::], # requires special main program 1165 [Qt:: => AnyEvent::Impl::Qt::], # requires special main program
1168 [Prima:: => AnyEvent::Impl::POE::], 1168 [Prima:: => AnyEvent::Impl::POE::],
1169 # IO::Async is just too broken - we would need workarounds for its 1169 # IO::Async is just too broken - we would need workarounds for its
1170 # byzantine signal and broken child handling, among others. 1170 # byzantine signal and broken child handling, among others.
1171 # IO::Async is rather hard to detect, as it doesn't have any 1171 # IO::Async is rather hard to detect, as it doesn't have any
1172 # obvious default class. 1172 # obvious default class.
1173# [0, IO::Async:: => AnyEvent::Impl::IOAsync::], # requires special main program 1173 [IO::Async:: => AnyEvent::Impl::IOAsync::], # requires special main program
1174# [0, IO::Async::Loop:: => AnyEvent::Impl::IOAsync::], # requires special main program 1174 [IO::Async::Loop:: => AnyEvent::Impl::IOAsync::], # requires special main program
1175# [0, IO::Async::Notifier:: => AnyEvent::Impl::IOAsync::], # requires special main program 1175 [IO::Async::Notifier:: => AnyEvent::Impl::IOAsync::], # requires special main program
1176 [AnyEvent::Impl::IOAsync:: => AnyEvent::Impl::IOAsync::], # requires special main program
1176); 1177);
1177 1178
1178our %method = map +($_ => 1), 1179our %method = map +($_ => 1),
1179 qw(io timer time now now_update signal child idle condvar one_event DESTROY); 1180 qw(io timer time now now_update signal child idle condvar one_event DESTROY);
1180 1181
1293# "new" API, currently only emulation of it 1294# "new" API, currently only emulation of it
1294############################################################################# 1295#############################################################################
1295 1296
1296package AE; 1297package AE;
1297 1298
1299our $VERSION = $AnyEvent::VERSION;
1300
1298sub io($$$) { 1301sub io($$$) {
1299 AnyEvent->io (fh => $_[0], poll => $_[1] ? "w" : "r", cb => $_[2]) 1302 AnyEvent->io (fh => $_[0], poll => $_[1] ? "w" : "r", cb => $_[2])
1300} 1303}
1301 1304
1302sub timer($$$) { 1305sub timer($$$) {
1303 AnyEvent->timer (after => $_[0], interval => $_[1], cb => $_[2]); 1306 AnyEvent->timer (after => $_[0], interval => $_[1], cb => $_[2])
1304} 1307}
1305 1308
1306sub signal($$) { 1309sub signal($$) {
1307 AnyEvent->signal (signal => $_[0], cb => $_[1]); 1310 AnyEvent->signal (signal => $_[0], cb => $_[1])
1308} 1311}
1309 1312
1310sub child($$) { 1313sub child($$) {
1311 AnyEvent->child (pid => $_[0], cb => $_[1]); 1314 AnyEvent->child (pid => $_[0], cb => $_[1])
1312} 1315}
1313 1316
1314sub idle($) { 1317sub idle($) {
1315 AnyEvent->idle (cb => $_[0]); 1318 AnyEvent->idle (cb => $_[0])
1316} 1319}
1317 1320
1318sub cv(;&) { 1321sub cv(;&) {
1319 AnyEvent->condvar (@_ ? (cb => $_[0]) : ()) 1322 AnyEvent->condvar (@_ ? (cb => $_[0]) : ())
1320} 1323}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines