… | |
… | |
1160 | |
1160 | |
1161 | static void |
1161 | static void |
1162 | io_cb (ev_loop *loop, ev_io *w, int revents) |
1162 | io_cb (ev_loop *loop, ev_io *w, int revents) |
1163 | { |
1163 | { |
1164 | // set the relevant poll flags |
1164 | // set the relevant poll flags |
|
|
1165 | // could also call adns_processreadable etc. here |
1165 | struct pollfd *fd = (struct pollfd *)w->data; |
1166 | struct pollfd *fd = (struct pollfd *)w->data; |
1166 | if (revents & EV_READ ) fd->revents |= fd->events & POLLIN; |
1167 | if (revents & EV_READ ) fd->revents |= fd->events & POLLIN; |
1167 | if (revents & EV_WRITE) fd->revents |= fd->events & POLLOUT; |
1168 | if (revents & EV_WRITE) fd->revents |= fd->events & POLLOUT; |
1168 | } |
1169 | } |
1169 | |
1170 | |
… | |
… | |
1755 | And a F<ev_cpp.C> implementation file that contains libev proper and is compiled: |
1756 | And a F<ev_cpp.C> implementation file that contains libev proper and is compiled: |
1756 | |
1757 | |
1757 | #include "ev_cpp.h" |
1758 | #include "ev_cpp.h" |
1758 | #include "ev.c" |
1759 | #include "ev.c" |
1759 | |
1760 | |
|
|
1761 | |
|
|
1762 | =head1 COMPLEXITIES |
|
|
1763 | |
|
|
1764 | In this section the complexities of (many of) the algorithms used inside |
|
|
1765 | libev will be explained. For complexity discussions about backends see the |
|
|
1766 | documentation for C<ev_default_init>. |
|
|
1767 | |
|
|
1768 | =over 4 |
|
|
1769 | |
|
|
1770 | =item Starting and stopping timer/periodic watchers: O(log skipped_other_timers) |
|
|
1771 | |
|
|
1772 | =item Changing timer/periodic watchers (by autorepeat, again): O(log skipped_other_timers) |
|
|
1773 | |
|
|
1774 | =item Starting io/check/prepare/idle/signal/child watchers: O(1) |
|
|
1775 | |
|
|
1776 | =item Stopping check/prepare/idle watchers: O(1) |
|
|
1777 | |
|
|
1778 | =item Stopping an io/signal/child watcher: O(number_of_watchers_for_this_(fd/signal/pid % 16)) |
|
|
1779 | |
|
|
1780 | =item Finding the next timer per loop iteration: O(1) |
|
|
1781 | |
|
|
1782 | =item Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd) |
|
|
1783 | |
|
|
1784 | =item Activating one watcher: O(1) |
|
|
1785 | |
|
|
1786 | =back |
|
|
1787 | |
|
|
1788 | |
1760 | =head1 AUTHOR |
1789 | =head1 AUTHOR |
1761 | |
1790 | |
1762 | Marc Lehmann <libev@schmorp.de>. |
1791 | Marc Lehmann <libev@schmorp.de>. |
1763 | |
1792 | |