… | |
… | |
1295 | .Vb 2 |
1295 | .Vb 2 |
1296 | \& static ev_io iow [nfd]; |
1296 | \& static ev_io iow [nfd]; |
1297 | \& static ev_timer tw; |
1297 | \& static ev_timer tw; |
1298 | .Ve |
1298 | .Ve |
1299 | .PP |
1299 | .PP |
1300 | .Vb 8 |
1300 | .Vb 9 |
1301 | \& static void |
1301 | \& static void |
1302 | \& io_cb (ev_loop *loop, ev_io *w, int revents) |
1302 | \& io_cb (ev_loop *loop, ev_io *w, int revents) |
1303 | \& { |
1303 | \& { |
1304 | \& // set the relevant poll flags |
1304 | \& // set the relevant poll flags |
|
|
1305 | \& // could also call adns_processreadable etc. here |
1305 | \& struct pollfd *fd = (struct pollfd *)w->data; |
1306 | \& struct pollfd *fd = (struct pollfd *)w->data; |
1306 | \& if (revents & EV_READ ) fd->revents |= fd->events & POLLIN; |
1307 | \& if (revents & EV_READ ) fd->revents |= fd->events & POLLIN; |
1307 | \& if (revents & EV_WRITE) fd->revents |= fd->events & POLLOUT; |
1308 | \& if (revents & EV_WRITE) fd->revents |= fd->events & POLLOUT; |
1308 | \& } |
1309 | \& } |
1309 | .Ve |
1310 | .Ve |
… | |
… | |
1900 | .Sp |
1901 | .Sp |
1901 | .Vb 2 |
1902 | .Vb 2 |
1902 | \& #include "ev_cpp.h" |
1903 | \& #include "ev_cpp.h" |
1903 | \& #include "ev.c" |
1904 | \& #include "ev.c" |
1904 | .Ve |
1905 | .Ve |
|
|
1906 | .SH "COMPLEXITIES" |
|
|
1907 | .IX Header "COMPLEXITIES" |
|
|
1908 | In this section the complexities of (many of) the algorithms used inside |
|
|
1909 | libev will be explained. For complexity discussions about backends see the |
|
|
1910 | documentation for \f(CW\*(C`ev_default_init\*(C'\fR. |
|
|
1911 | .RS 4 |
|
|
1912 | .IP "Starting and stopping timer/periodic watchers: O(log skipped_other_timers)" 4 |
|
|
1913 | .IX Item "Starting and stopping timer/periodic watchers: O(log skipped_other_timers)" |
|
|
1914 | .PD 0 |
|
|
1915 | .IP "Changing timer/periodic watchers (by autorepeat, again): O(log skipped_other_timers)" 4 |
|
|
1916 | .IX Item "Changing timer/periodic watchers (by autorepeat, again): O(log skipped_other_timers)" |
|
|
1917 | .IP "Starting io/check/prepare/idle/signal/child watchers: O(1)" 4 |
|
|
1918 | .IX Item "Starting io/check/prepare/idle/signal/child watchers: O(1)" |
|
|
1919 | .IP "Stopping check/prepare/idle watchers: O(1)" 4 |
|
|
1920 | .IX Item "Stopping check/prepare/idle watchers: O(1)" |
|
|
1921 | .IP "Stopping an io/signal/child watcher: O(number_of_watchers_for_this_(fd/signal/pid % 16))" 4 |
|
|
1922 | .IX Item "Stopping an io/signal/child watcher: O(number_of_watchers_for_this_(fd/signal/pid % 16))" |
|
|
1923 | .IP "Finding the next timer per loop iteration: O(1)" 4 |
|
|
1924 | .IX Item "Finding the next timer per loop iteration: O(1)" |
|
|
1925 | .IP "Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd)" 4 |
|
|
1926 | .IX Item "Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd)" |
|
|
1927 | .IP "Activating one watcher: O(1)" 4 |
|
|
1928 | .IX Item "Activating one watcher: O(1)" |
|
|
1929 | .RE |
|
|
1930 | .RS 4 |
|
|
1931 | .PD |
1905 | .SH "AUTHOR" |
1932 | .SH "AUTHOR" |
1906 | .IX Header "AUTHOR" |
1933 | .IX Header "AUTHOR" |
1907 | Marc Lehmann <libev@schmorp.de>. |
1934 | Marc Lehmann <libev@schmorp.de>. |