… | |
… | |
1878 | // timeout occurred, take action |
1878 | // timeout occurred, take action |
1879 | } |
1879 | } |
1880 | else |
1880 | else |
1881 | { |
1881 | { |
1882 | // callback was invoked, but there was some recent |
1882 | // callback was invoked, but there was some recent |
1883 | // activity. simply restart the timer to time out |
1883 | // activity. simply restart the timer to time out |
1884 | // after "after" seconds, which is the earliest time |
1884 | // after "after" seconds, which is the earliest time |
1885 | // the timeout can occur. |
1885 | // the timeout can occur. |
1886 | ev_timer_set (w, after, 0.); |
1886 | ev_timer_set (w, after, 0.); |
1887 | ev_timer_start (EV_A_ w); |
1887 | ev_timer_start (EV_A_ w); |
1888 | } |
1888 | } |
… | |
… | |
2108 | keep up with the timer (because it takes longer than those 10 seconds to |
2108 | keep up with the timer (because it takes longer than those 10 seconds to |
2109 | do stuff) the timer will not fire more than once per event loop iteration. |
2109 | do stuff) the timer will not fire more than once per event loop iteration. |
2110 | |
2110 | |
2111 | =item ev_timer_again (loop, ev_timer *) |
2111 | =item ev_timer_again (loop, ev_timer *) |
2112 | |
2112 | |
2113 | This will act as if the timer timed out and restarts it again if it is |
2113 | This will act as if the timer timed out, and restarts it again if it is |
2114 | repeating. The exact semantics are: |
2114 | repeating. It basically works like calling C<ev_timer_stop>, updating the |
|
|
2115 | timeout to the C<repeat> value and calling C<ev_timer_start>. |
2115 | |
2116 | |
|
|
2117 | The exact semantics are as in the following rules, all of which will be |
|
|
2118 | applied to the watcher: |
|
|
2119 | |
|
|
2120 | =over 4 |
|
|
2121 | |
2116 | If the timer is pending, its pending status is cleared. |
2122 | =item If the timer is pending, the pending status is always cleared. |
2117 | |
2123 | |
2118 | If the timer is started but non-repeating, stop it (as if it timed out). |
2124 | =item If the timer is started but non-repeating, stop it (as if it timed |
|
|
2125 | out, without invoking it). |
2119 | |
2126 | |
2120 | If the timer is repeating, either start it if necessary (with the |
2127 | =item If the timer is repeating, make the C<repeat> value the new timeout |
2121 | C<repeat> value), or reset the running timer to the C<repeat> value. |
2128 | and start the timer, if necessary. |
|
|
2129 | |
|
|
2130 | =back |
2122 | |
2131 | |
2123 | This sounds a bit complicated, see L<Be smart about timeouts>, above, for a |
2132 | This sounds a bit complicated, see L<Be smart about timeouts>, above, for a |
2124 | usage example. |
2133 | usage example. |
2125 | |
2134 | |
2126 | =item ev_tstamp ev_timer_remaining (loop, ev_timer *) |
2135 | =item ev_tstamp ev_timer_remaining (loop, ev_timer *) |
… | |
… | |
3926 | =item C<ev::io>, C<ev::timer>, C<ev::periodic>, C<ev::idle>, C<ev::sig> etc. |
3935 | =item C<ev::io>, C<ev::timer>, C<ev::periodic>, C<ev::idle>, C<ev::sig> etc. |
3927 | |
3936 | |
3928 | For each C<ev_TYPE> watcher in F<ev.h> there is a corresponding class of |
3937 | For each C<ev_TYPE> watcher in F<ev.h> there is a corresponding class of |
3929 | the same name in the C<ev> namespace, with the exception of C<ev_signal> |
3938 | the same name in the C<ev> namespace, with the exception of C<ev_signal> |
3930 | which is called C<ev::sig> to avoid clashes with the C<signal> macro |
3939 | which is called C<ev::sig> to avoid clashes with the C<signal> macro |
3931 | defines by many implementations. |
3940 | defined by many implementations. |
3932 | |
3941 | |
3933 | All of those classes have these methods: |
3942 | All of those classes have these methods: |
3934 | |
3943 | |
3935 | =over 4 |
3944 | =over 4 |
3936 | |
3945 | |
… | |
… | |
4663 | and do not want its identifiers to be visible. |
4672 | and do not want its identifiers to be visible. |
4664 | |
4673 | |
4665 | To use this, define C<EV_API_STATIC> and include F<ev.c> in the file that |
4674 | To use this, define C<EV_API_STATIC> and include F<ev.c> in the file that |
4666 | wants to use libev. |
4675 | wants to use libev. |
4667 | |
4676 | |
|
|
4677 | This option only works when libev is compiled with a C compiler, as C++ |
|
|
4678 | doesn't support the required declaration syntax. |
|
|
4679 | |
4668 | =item EV_AVOID_STDIO |
4680 | =item EV_AVOID_STDIO |
4669 | |
4681 | |
4670 | If this is set to C<1> at compiletime, then libev will avoid using stdio |
4682 | If this is set to C<1> at compiletime, then libev will avoid using stdio |
4671 | functions (printf, scanf, perror etc.). This will increase the code size |
4683 | functions (printf, scanf, perror etc.). This will increase the code size |
4672 | somewhat, but if your program doesn't otherwise depend on stdio and your |
4684 | somewhat, but if your program doesn't otherwise depend on stdio and your |