ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.pod
(Generate patch)

Comparing libev/ev.pod (file contents):
Revision 1.303 by root, Thu Oct 14 04:29:34 2010 UTC vs.
Revision 1.306 by root, Mon Oct 18 07:36:05 2010 UTC

439of course I<doesn't>, and epoll just loves to report events for totally 439of course I<doesn't>, and epoll just loves to report events for totally
440I<different> file descriptors (even already closed ones, so one cannot 440I<different> file descriptors (even already closed ones, so one cannot
441even remove them from the set) than registered in the set (especially 441even remove them from the set) than registered in the set (especially
442on SMP systems). Libev tries to counter these spurious notifications by 442on SMP systems). Libev tries to counter these spurious notifications by
443employing an additional generation counter and comparing that against the 443employing an additional generation counter and comparing that against the
444events to filter out spurious ones, recreating the set when required. 444events to filter out spurious ones, recreating the set when required. Last
445not least, it also refuses to work with some file descriptors which work
446perfectly fine with C<select> (files, many character devices...).
445 447
446While stopping, setting and starting an I/O watcher in the same iteration 448While stopping, setting and starting an I/O watcher in the same iteration
447will result in some caching, there is still a system call per such 449will result in some caching, there is still a system call per such
448incident (because the same I<file descriptor> could point to a different 450incident (because the same I<file descriptor> could point to a different
449I<file description> now), so its best to avoid that. Also, C<dup ()>'ed 451I<file description> now), so its best to avoid that. Also, C<dup ()>'ed
4423=head3 C<kqueue> is buggy 4425=head3 C<kqueue> is buggy
4424 4426
4425The kqueue syscall is broken in all known versions - most versions support 4427The kqueue syscall is broken in all known versions - most versions support
4426only sockets, many support pipes. 4428only sockets, many support pipes.
4427 4429
4430Libev tries to work around this by not using C<kqueue> by default on
4431this rotten platform, but of course you can still ask for it when creating
4432a loop.
4433
4428=head3 C<poll> is buggy 4434=head3 C<poll> is buggy
4429 4435
4430Instead of fixing C<kqueue>, Apple replaced their (working) C<poll> 4436Instead of fixing C<kqueue>, Apple replaced their (working) C<poll>
4431implementation by something calling C<kqueue> internally around the 10.5.6 4437implementation by something calling C<kqueue> internally around the 10.5.6
4432release, so now C<kqueue> I<and> C<poll> are broken. 4438release, so now C<kqueue> I<and> C<poll> are broken.
4433 4439
4434Libev tries to work around this by neither using C<kqueue> nor C<poll> by 4440Libev tries to work around this by not using C<poll> by default on
4435default on this rotten platform, but of course you cna still ask for them 4441this rotten platform, but of course you can still ask for it when creating
4436when creating a loop. 4442a loop.
4437 4443
4438=head3 C<select> is buggy 4444=head3 C<select> is buggy
4439 4445
4440All that's left is C<select>, and of course Apple found a way to fuck this 4446All that's left is C<select>, and of course Apple found a way to fuck this
4441one up as well: On OS/X, C<select> actively limits the number of file 4447one up as well: On OS/X, C<select> actively limits the number of file
4442descriptors you can pass in to 1024 - your program suddenyl crashes when 4448descriptors you can pass in to 1024 - your program suddenly crashes when
4443you use more. 4449you use more.
4444 4450
4445There is an undocumented "workaround" for this - defining 4451There is an undocumented "workaround" for this - defining
4446C<_DARWIN_UNLIMITED_SELECT>, which libev tries to use, so select I<should> 4452C<_DARWIN_UNLIMITED_SELECT>, which libev tries to use, so select I<should>
4447work on OS/X. 4453work on OS/X.
4464this mechanism is very buggy. If you run into high CPU usage, your program 4470this mechanism is very buggy. If you run into high CPU usage, your program
4465freezes or you get a large number of spurious wakeups, make sure you have 4471freezes or you get a large number of spurious wakeups, make sure you have
4466all the relevant and latest kernel patches applied. No, I don't know which 4472all the relevant and latest kernel patches applied. No, I don't know which
4467ones, but there are multiple ones. 4473ones, but there are multiple ones.
4468 4474
4469If you can't get it to work, you can try running the program with 4475If you can't get it to work, you can try running the program by setting
4470C<LIBEV_FLAGS=3> to only allow C<poll> and C<select> backends. 4476the environment variable C<LIBEV_FLAGS=3> to only allow C<poll> and
4477C<select> backends.
4471 4478
4472=head2 AIX POLL BUG 4479=head2 AIX POLL BUG
4473 4480
4474AIX unfortunately has a broken C<poll.h> header. Libev works around 4481AIX unfortunately has a broken C<poll.h> header. Libev works around
4475this by trying to avoid the poll backend altogether (i.e. it's not even 4482this by trying to avoid the poll backend altogether (i.e. it's not even

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines