… | |
… | |
3823 | switch_to (libev_coro); |
3823 | switch_to (libev_coro); |
3824 | } |
3824 | } |
3825 | |
3825 | |
3826 | That basically suspends the coroutine inside C<wait_for_event> and |
3826 | That basically suspends the coroutine inside C<wait_for_event> and |
3827 | continues the libev coroutine, which, when appropriate, switches back to |
3827 | continues the libev coroutine, which, when appropriate, switches back to |
3828 | this or any other coroutine. I am sure if you sue this your own :) |
3828 | this or any other coroutine. |
3829 | |
3829 | |
3830 | You can do similar tricks if you have, say, threads with an event queue - |
3830 | You can do similar tricks if you have, say, threads with an event queue - |
3831 | instead of storing a coroutine, you store the queue object and instead of |
3831 | instead of storing a coroutine, you store the queue object and instead of |
3832 | switching to a coroutine, you push the watcher onto the queue and notify |
3832 | switching to a coroutine, you push the watcher onto the queue and notify |
3833 | any waiters. |
3833 | any waiters. |
… | |
… | |
3926 | =item C<ev::io>, C<ev::timer>, C<ev::periodic>, C<ev::idle>, C<ev::sig> etc. |
3926 | =item C<ev::io>, C<ev::timer>, C<ev::periodic>, C<ev::idle>, C<ev::sig> etc. |
3927 | |
3927 | |
3928 | For each C<ev_TYPE> watcher in F<ev.h> there is a corresponding class of |
3928 | 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> |
3929 | 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 |
3930 | which is called C<ev::sig> to avoid clashes with the C<signal> macro |
3931 | defines by many implementations. |
3931 | defined by many implementations. |
3932 | |
3932 | |
3933 | All of those classes have these methods: |
3933 | All of those classes have these methods: |
3934 | |
3934 | |
3935 | =over 4 |
3935 | =over 4 |
3936 | |
3936 | |