--- libev/ev.pod 2010/10/24 18:01:26 1.323 +++ libev/ev.pod 2010/10/24 19:38:20 1.324 @@ -1114,6 +1114,10 @@ The event loop has been resumed in the child process after fork (see C). +=item C + +The event loop is abotu to be destroyed (see C). + =item C The given async watcher has been asynchronously notified (see C). @@ -3101,6 +3105,41 @@ =back +=head2 C - even the best things end + +Cleanup watchers are called just before the event loop they are registered +with is being destroyed. + +While there is no guarantee that the event loop gets destroyed, cleanup +watchers provide a convenient method to install cleanup watchers for your +program, worker threads and so on - you just to make sure to destroy the +loop when you want them to be invoked. + +=head3 Watcher-Specific Functions and Data Members + +=over 4 + +=item ev_cleanup_init (ev_signal *, callback) + +Initialises and configures the cleanup watcher - it has no parameters of +any kind. There is a C macro, but using it is utterly +pointless, believe me. + +=back + +Example: Register an atexit handler to destroy the default loop, so any +cleanup functions are called. + + static void + program_exits (void) + { + ev_loop_destroy (EV_DEFAULT_UC); + } + + ... + atexit (program_exits); + + =head2 C - how to wake up an event loop In general, you cannot use an C from multiple threads or other