… | |
… | |
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 | |
… | |
… | |
1699 | will have the C<struct ev_loop *> as first argument, and you can create |
1700 | will have the C<struct ev_loop *> as first argument, and you can create |
1700 | additional independent event loops. Otherwise there will be no support |
1701 | additional independent event loops. Otherwise there will be no support |
1701 | for multiple event loops and there is no first event loop pointer |
1702 | for multiple event loops and there is no first event loop pointer |
1702 | argument. Instead, all functions act on the single default loop. |
1703 | argument. Instead, all functions act on the single default loop. |
1703 | |
1704 | |
1704 | =item EV_PERIODICS |
1705 | =item EV_PERIODIC_ENABLE |
1705 | |
1706 | |
1706 | If undefined or defined to be C<1>, then periodic timers are supported, |
1707 | If undefined or defined to be C<1>, then periodic timers are supported. If |
1707 | otherwise not. This saves a few kb of code. |
1708 | defined to be C<0>, then they are not. Disabling them saves a few kB of |
|
|
1709 | code. |
|
|
1710 | |
|
|
1711 | =item EV_EMBED_ENABLE |
|
|
1712 | |
|
|
1713 | If undefined or defined to be C<1>, then embed watchers are supported. If |
|
|
1714 | defined to be C<0>, then they are not. |
|
|
1715 | |
|
|
1716 | =item EV_STAT_ENABLE |
|
|
1717 | |
|
|
1718 | If undefined or defined to be C<1>, then stat watchers are supported. If |
|
|
1719 | defined to be C<0>, then they are not. |
|
|
1720 | |
|
|
1721 | =item EV_MINIMAL |
|
|
1722 | |
|
|
1723 | If you need to shave off some kilobytes of code at the expense of some |
|
|
1724 | speed, define this symbol to C<1>. Currently only used for gcc to override |
|
|
1725 | some inlining decisions, saves roughly 30% codesize of amd64. |
1708 | |
1726 | |
1709 | =item EV_COMMON |
1727 | =item EV_COMMON |
1710 | |
1728 | |
1711 | By default, all watchers have a C<void *data> member. By redefining |
1729 | By default, all watchers have a C<void *data> member. By redefining |
1712 | this macro to a something else you can include more and other types of |
1730 | this macro to a something else you can include more and other types of |
… | |
… | |
1755 | And a F<ev_cpp.C> implementation file that contains libev proper and is compiled: |
1773 | And a F<ev_cpp.C> implementation file that contains libev proper and is compiled: |
1756 | |
1774 | |
1757 | #include "ev_cpp.h" |
1775 | #include "ev_cpp.h" |
1758 | #include "ev.c" |
1776 | #include "ev.c" |
1759 | |
1777 | |
|
|
1778 | |
|
|
1779 | =head1 COMPLEXITIES |
|
|
1780 | |
|
|
1781 | In this section the complexities of (many of) the algorithms used inside |
|
|
1782 | libev will be explained. For complexity discussions about backends see the |
|
|
1783 | documentation for C<ev_default_init>. |
|
|
1784 | |
|
|
1785 | =over 4 |
|
|
1786 | |
|
|
1787 | =item Starting and stopping timer/periodic watchers: O(log skipped_other_timers) |
|
|
1788 | |
|
|
1789 | =item Changing timer/periodic watchers (by autorepeat, again): O(log skipped_other_timers) |
|
|
1790 | |
|
|
1791 | =item Starting io/check/prepare/idle/signal/child watchers: O(1) |
|
|
1792 | |
|
|
1793 | =item Stopping check/prepare/idle watchers: O(1) |
|
|
1794 | |
|
|
1795 | =item Stopping an io/signal/child watcher: O(number_of_watchers_for_this_(fd/signal/pid % 16)) |
|
|
1796 | |
|
|
1797 | =item Finding the next timer per loop iteration: O(1) |
|
|
1798 | |
|
|
1799 | =item Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd) |
|
|
1800 | |
|
|
1801 | =item Activating one watcher: O(1) |
|
|
1802 | |
|
|
1803 | =back |
|
|
1804 | |
|
|
1805 | |
1760 | =head1 AUTHOR |
1806 | =head1 AUTHOR |
1761 | |
1807 | |
1762 | Marc Lehmann <libev@schmorp.de>. |
1808 | Marc Lehmann <libev@schmorp.de>. |
1763 | |
1809 | |