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