… | |
… | |
792 | |
792 | |
793 | Ref/unref can be used to add or remove a reference count on the event |
793 | Ref/unref can be used to add or remove a reference count on the event |
794 | loop: Every watcher keeps one reference, and as long as the reference |
794 | loop: Every watcher keeps one reference, and as long as the reference |
795 | count is nonzero, C<ev_loop> will not return on its own. |
795 | count is nonzero, C<ev_loop> will not return on its own. |
796 | |
796 | |
797 | If you have a watcher you never unregister that should not keep C<ev_loop> |
797 | This is useful when you have a watcher that you never intend to |
798 | from returning, call ev_unref() after starting, and ev_ref() before |
798 | unregister, but that nevertheless should not keep C<ev_loop> from |
|
|
799 | returning. In such a case, call C<ev_unref> after starting, and C<ev_ref> |
799 | stopping it. |
800 | before stopping it. |
800 | |
801 | |
801 | As an example, libev itself uses this for its internal signal pipe: It |
802 | As an example, libev itself uses this for its internal signal pipe: It |
802 | is not visible to the libev user and should not keep C<ev_loop> from |
803 | is not visible to the libev user and should not keep C<ev_loop> from |
803 | exiting if no event watchers registered by it are active. It is also an |
804 | exiting if no event watchers registered by it are active. It is also an |
804 | excellent way to do this for generic recurring timers or from within |
805 | excellent way to do this for generic recurring timers or from within |
… | |
… | |
1854 | C<repeat> value), or reset the running timer to the C<repeat> value. |
1855 | C<repeat> value), or reset the running timer to the C<repeat> value. |
1855 | |
1856 | |
1856 | This sounds a bit complicated, see L<Be smart about timeouts>, above, for a |
1857 | This sounds a bit complicated, see L<Be smart about timeouts>, above, for a |
1857 | usage example. |
1858 | usage example. |
1858 | |
1859 | |
1859 | =item ev_timer_remaining (loop, ev_timer *) |
1860 | =item ev_tstamp ev_timer_remaining (loop, ev_timer *) |
1860 | |
1861 | |
1861 | Returns the remaining time until a timer fires. If the timer is active, |
1862 | Returns the remaining time until a timer fires. If the timer is active, |
1862 | then this time is relative to the current event loop time, otherwise it's |
1863 | then this time is relative to the current event loop time, otherwise it's |
1863 | the timeout value currently configured. |
1864 | the timeout value currently configured. |
1864 | |
1865 | |