… | |
… | |
4 | <head> |
4 | <head> |
5 | <title>libev</title> |
5 | <title>libev</title> |
6 | <meta name="description" content="Pod documentation for libev" /> |
6 | <meta name="description" content="Pod documentation for libev" /> |
7 | <meta name="inputfile" content="<standard input>" /> |
7 | <meta name="inputfile" content="<standard input>" /> |
8 | <meta name="outputfile" content="<standard output>" /> |
8 | <meta name="outputfile" content="<standard output>" /> |
9 | <meta name="created" content="Mon Nov 26 10:52:13 2007" /> |
9 | <meta name="created" content="Mon Nov 26 11:20:35 2007" /> |
10 | <meta name="generator" content="Pod::Xhtml 1.57" /> |
10 | <meta name="generator" content="Pod::Xhtml 1.57" /> |
11 | <link rel="stylesheet" href="http://res.tst.eu/pod.css"/></head> |
11 | <link rel="stylesheet" href="http://res.tst.eu/pod.css"/></head> |
12 | <body> |
12 | <body> |
13 | <div class="pod"> |
13 | <div class="pod"> |
14 | <!-- INDEX START --> |
14 | <!-- INDEX START --> |
… | |
… | |
50 | </li> |
50 | </li> |
51 | <li><a href="#PREPROCESSOR_SYMBOLS_MACROS">PREPROCESSOR SYMBOLS/MACROS</a></li> |
51 | <li><a href="#PREPROCESSOR_SYMBOLS_MACROS">PREPROCESSOR SYMBOLS/MACROS</a></li> |
52 | <li><a href="#EXAMPLES">EXAMPLES</a></li> |
52 | <li><a href="#EXAMPLES">EXAMPLES</a></li> |
53 | </ul> |
53 | </ul> |
54 | </li> |
54 | </li> |
|
|
55 | <li><a href="#COMPLEXITIES">COMPLEXITIES</a></li> |
55 | <li><a href="#AUTHOR">AUTHOR</a> |
56 | <li><a href="#AUTHOR">AUTHOR</a> |
56 | </li> |
57 | </li> |
57 | </ul><hr /> |
58 | </ul><hr /> |
58 | <!-- INDEX END --> |
59 | <!-- INDEX END --> |
59 | |
60 | |
… | |
… | |
1176 | |
1177 | |
1177 | static void |
1178 | static void |
1178 | io_cb (ev_loop *loop, ev_io *w, int revents) |
1179 | io_cb (ev_loop *loop, ev_io *w, int revents) |
1179 | { |
1180 | { |
1180 | // set the relevant poll flags |
1181 | // set the relevant poll flags |
|
|
1182 | // could also call adns_processreadable etc. here |
1181 | struct pollfd *fd = (struct pollfd *)w->data; |
1183 | struct pollfd *fd = (struct pollfd *)w->data; |
1182 | if (revents & EV_READ ) fd->revents |= fd->events & POLLIN; |
1184 | if (revents & EV_READ ) fd->revents |= fd->events & POLLIN; |
1183 | if (revents & EV_WRITE) fd->revents |= fd->events & POLLOUT; |
1185 | if (revents & EV_WRITE) fd->revents |= fd->events & POLLOUT; |
1184 | } |
1186 | } |
1185 | |
1187 | |
… | |
… | |
1753 | </pre> |
1755 | </pre> |
1754 | <p>And a <cite>ev_cpp.C</cite> implementation file that contains libev proper and is compiled:</p> |
1756 | <p>And a <cite>ev_cpp.C</cite> implementation file that contains libev proper and is compiled:</p> |
1755 | <pre> #include "ev_cpp.h" |
1757 | <pre> #include "ev_cpp.h" |
1756 | #include "ev.c" |
1758 | #include "ev.c" |
1757 | |
1759 | |
|
|
1760 | |
|
|
1761 | |
|
|
1762 | |
1758 | </pre> |
1763 | </pre> |
|
|
1764 | |
|
|
1765 | </div> |
|
|
1766 | <h1 id="COMPLEXITIES">COMPLEXITIES</h1><p><a href="#TOP" class="toplink">Top</a></p> |
|
|
1767 | <div id="COMPLEXITIES_CONTENT"> |
|
|
1768 | <p>In this section the complexities of (many of) the algorithms used inside |
|
|
1769 | libev will be explained. For complexity discussions about backends see the |
|
|
1770 | documentation for <code>ev_default_init</code>.</p> |
|
|
1771 | <p> |
|
|
1772 | <dl> |
|
|
1773 | <dt>Starting and stopping timer/periodic watchers: O(log skipped_other_timers)</dt> |
|
|
1774 | <dt>Changing timer/periodic watchers (by autorepeat, again): O(log skipped_other_timers)</dt> |
|
|
1775 | <dt>Starting io/check/prepare/idle/signal/child watchers: O(1)</dt> |
|
|
1776 | <dt>Stopping check/prepare/idle watchers: O(1)</dt> |
|
|
1777 | <dt>Stopping an io/signal/child watcher: O(number_of_watchers_for_this_(fd/signal/pid % 16))</dt> |
|
|
1778 | <dt>Finding the next timer per loop iteration: O(1)</dt> |
|
|
1779 | <dt>Each change on a file descriptor per loop iteration: O(number_of_watchers_for_this_fd)</dt> |
|
|
1780 | <dt>Activating one watcher: O(1)</dt> |
|
|
1781 | </dl> |
|
|
1782 | </p> |
|
|
1783 | |
|
|
1784 | |
|
|
1785 | |
|
|
1786 | |
1759 | |
1787 | |
1760 | </div> |
1788 | </div> |
1761 | <h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p> |
1789 | <h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p> |
1762 | <div id="AUTHOR_CONTENT"> |
1790 | <div id="AUTHOR_CONTENT"> |
1763 | <p>Marc Lehmann <libev@schmorp.de>.</p> |
1791 | <p>Marc Lehmann <libev@schmorp.de>.</p> |