… | |
… | |
1318 | |
1318 | |
1319 | =item callback ev_cb (ev_TYPE *watcher) |
1319 | =item callback ev_cb (ev_TYPE *watcher) |
1320 | |
1320 | |
1321 | Returns the callback currently set on the watcher. |
1321 | Returns the callback currently set on the watcher. |
1322 | |
1322 | |
1323 | =item ev_cb_set (ev_TYPE *watcher, callback) |
1323 | =item ev_set_cb (ev_TYPE *watcher, callback) |
1324 | |
1324 | |
1325 | Change the callback. You can change the callback at virtually any time |
1325 | Change the callback. You can change the callback at virtually any time |
1326 | (modulo threads). |
1326 | (modulo threads). |
1327 | |
1327 | |
1328 | =item ev_set_priority (ev_TYPE *watcher, int priority) |
1328 | =item ev_set_priority (ev_TYPE *watcher, int priority) |
… | |
… | |
3875 | called): |
3875 | called): |
3876 | |
3876 | |
3877 | void |
3877 | void |
3878 | wait_for_event (ev_watcher *w) |
3878 | wait_for_event (ev_watcher *w) |
3879 | { |
3879 | { |
3880 | ev_cb_set (w) = current_coro; |
3880 | ev_set_cb (w) = current_coro; |
3881 | switch_to (libev_coro); |
3881 | switch_to (libev_coro); |
3882 | } |
3882 | } |
3883 | |
3883 | |
3884 | That basically suspends the coroutine inside C<wait_for_event> and |
3884 | That basically suspends the coroutine inside C<wait_for_event> and |
3885 | continues the libev coroutine, which, when appropriate, switches back to |
3885 | continues the libev coroutine, which, when appropriate, switches back to |