… | |
… | |
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 |