--- libev/ev.pod 2012/05/03 16:00:47 1.406 +++ libev/ev.pod 2012/05/04 20:46:17 1.410 @@ -1320,7 +1320,7 @@ Returns the callback currently set on the watcher. -=item ev_cb_set (ev_TYPE *watcher, callback) +=item ev_set_cb (ev_TYPE *watcher, callback) Change the callback. You can change the callback at virtually any time (modulo threads). @@ -2860,7 +2860,7 @@ to do something on each event loop iteration - for example to balance load between different connections. -See L watcher for its side-effect> for a longer +See L<< Abusing an C watcher for its side-effect >> for a longer example. =head3 Watcher-Specific Functions and Data Members @@ -2883,7 +2883,12 @@ static void idle_cb (struct ev_loop *loop, ev_idle *w, int revents) { + // stop the watcher + ev_idle_stop (loop, w); + + // now we can free it free (w); + // now do something you wanted to do when the program has // no longer anything immediate to do. } @@ -3872,7 +3877,7 @@ void wait_for_event (ev_watcher *w) { - ev_cb_set (w) = current_coro; + ev_set_cb (w, current_coro); switch_to (libev_coro); }