… | |
… | |
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="Fri Dec 7 21:19:14 2007" /> |
9 | <meta name="created" content="Sat Dec 8 15:27: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 --> |
… | |
… | |
769 | <dt>bool ev_is_pending (ev_TYPE *watcher)</dt> |
769 | <dt>bool ev_is_pending (ev_TYPE *watcher)</dt> |
770 | <dd> |
770 | <dd> |
771 | <p>Returns a true value iff the watcher is pending, (i.e. it has outstanding |
771 | <p>Returns a true value iff the watcher is pending, (i.e. it has outstanding |
772 | events but its callback has not yet been invoked). As long as a watcher |
772 | events but its callback has not yet been invoked). As long as a watcher |
773 | is pending (but not active) you must not call an init function on it (but |
773 | is pending (but not active) you must not call an init function on it (but |
774 | <code>ev_TYPE_set</code> is safe) and you must make sure the watcher is available to |
774 | <code>ev_TYPE_set</code> is safe), you must not change its priority, and you must |
775 | libev (e.g. you cnanot <code>free ()</code> it).</p> |
775 | make sure the watcher is available to libev (e.g. you cannot <code>free ()</code> |
|
|
776 | it).</p> |
776 | </dd> |
777 | </dd> |
777 | <dt>callback ev_cb (ev_TYPE *watcher)</dt> |
778 | <dt>callback ev_cb (ev_TYPE *watcher)</dt> |
778 | <dd> |
779 | <dd> |
779 | <p>Returns the callback currently set on the watcher.</p> |
780 | <p>Returns the callback currently set on the watcher.</p> |
780 | </dd> |
781 | </dd> |
… | |
… | |
795 | invocation after new events have been received. This is useful, for |
796 | invocation after new events have been received. This is useful, for |
796 | example, to reduce latency after idling, or more often, to bind two |
797 | example, to reduce latency after idling, or more often, to bind two |
797 | watchers on the same event and make sure one is called first.</p> |
798 | watchers on the same event and make sure one is called first.</p> |
798 | <p>If you need to suppress invocation when higher priority events are pending |
799 | <p>If you need to suppress invocation when higher priority events are pending |
799 | you need to look at <code>ev_idle</code> watchers, which provide this functionality.</p> |
800 | you need to look at <code>ev_idle</code> watchers, which provide this functionality.</p> |
|
|
801 | <p>You <i>must not</i> change the priority of a watcher as long as it is active or |
|
|
802 | pending.</p> |
800 | <p>The default priority used by watchers when no priority has been set is |
803 | <p>The default priority used by watchers when no priority has been set is |
801 | always <code>0</code>, which is supposed to not be too high and not be too low :).</p> |
804 | always <code>0</code>, which is supposed to not be too high and not be too low :).</p> |
802 | <p>Setting a priority outside the range of <code>EV_MINPRI</code> to <code>EV_MAXPRI</code> is |
805 | <p>Setting a priority outside the range of <code>EV_MINPRI</code> to <code>EV_MAXPRI</code> is |
803 | fine, as long as you do not mind that the priority value you query might |
806 | fine, as long as you do not mind that the priority value you query might |
804 | or might not have been adjusted to be within valid range.</p> |
807 | or might not have been adjusted to be within valid range.</p> |
|
|
808 | </dd> |
|
|
809 | <dt>ev_invoke (loop, ev_TYPE *watcher, int revents)</dt> |
|
|
810 | <dd> |
|
|
811 | <p>Invoke the <code>watcher</code> with the given <code>loop</code> and <code>revents</code>. Neither |
|
|
812 | <code>loop</code> nor <code>revents</code> need to be valid as long as the watcher callback |
|
|
813 | can deal with that fact.</p> |
|
|
814 | </dd> |
|
|
815 | <dt>int ev_clear_pending (loop, ev_TYPE *watcher)</dt> |
|
|
816 | <dd> |
|
|
817 | <p>If the watcher is pending, this function returns clears its pending status |
|
|
818 | and returns its <code>revents</code> bitset (as if its callback was invoked). If the |
|
|
819 | watcher isn't pending it does nothing and returns <code>0</code>.</p> |
805 | </dd> |
820 | </dd> |
806 | </dl> |
821 | </dl> |
807 | |
822 | |
808 | |
823 | |
809 | |
824 | |
… | |
… | |
1806 | ev::io iow; |
1821 | ev::io iow; |
1807 | iow.set <myclass, &myclass::io_cb> (&obj); |
1822 | iow.set <myclass, &myclass::io_cb> (&obj); |
1808 | |
1823 | |
1809 | </pre> |
1824 | </pre> |
1810 | </dd> |
1825 | </dd> |
1811 | <dt>w->set (void (*function)(watcher &w, int), void *data = 0)</dt> |
1826 | <dt>w->set<function> (void *data = 0)</dt> |
1812 | <dd> |
1827 | <dd> |
1813 | <p>Also sets a callback, but uses a static method or plain function as |
1828 | <p>Also sets a callback, but uses a static method or plain function as |
1814 | callback. The optional <code>data</code> argument will be stored in the watcher's |
1829 | callback. The optional <code>data</code> argument will be stored in the watcher's |
1815 | <code>data</code> member and is free for you to use.</p> |
1830 | <code>data</code> member and is free for you to use.</p> |
|
|
1831 | <p>The prototype of the <code>function</code> must be <code>void (*)(ev::TYPE &w, int)</code>.</p> |
1816 | <p>See the method-<code>set</code> above for more details.</p> |
1832 | <p>See the method-<code>set</code> above for more details.</p> |
|
|
1833 | <p>Example:</p> |
|
|
1834 | <pre> static void io_cb (ev::io &w, int revents) { } |
|
|
1835 | iow.set <io_cb> (); |
|
|
1836 | |
|
|
1837 | </pre> |
1817 | </dd> |
1838 | </dd> |
1818 | <dt>w->set (struct ev_loop *)</dt> |
1839 | <dt>w->set (struct ev_loop *)</dt> |
1819 | <dd> |
1840 | <dd> |
1820 | <p>Associates a different <code>struct ev_loop</code> with this watcher. You can only |
1841 | <p>Associates a different <code>struct ev_loop</code> with this watcher. You can only |
1821 | do this when the watcher is inactive (and not pending either).</p> |
1842 | do this when the watcher is inactive (and not pending either).</p> |