From 2e4f855ad17fd958d1643d2170054734053033fc Mon Sep 17 00:00:00 2001
From: root ev_idle - when you've got nothing better to do...ev_prepare and ev_check - customise your event loop!ev_embed - when one backend isn't enough...ev_fork - the audacity to resume the event loop after a forkev_tstamp, which is what you should use too. It usually alia
to the double type in C, and when you need to do any calculations on
it, you should treat it as such.
ev_prepare watcher might start an idle watcher to keep
ev_loop from blocking).
+
+ EV_EMBEDThe embedded event loop specified in the ev_embed watcher needs attention.
EV_FORKThe event loop has been resumed in the child process after fork (see
+ev_fork).
EV_ERRORev_fork - the audacity to resume the event loop after a forkFork watchers are called when a fork () was detected (usually because
+whoever is a good citizen cared to tell libev about it by calling
+ev_default_fork or ev_loop_fork). The invocation is done before the
+event loop blocks next and before ev_check watchers are being called,
+and only in the child after the fork. If whoever good citizen calling
+ev_default_fork cheats and calls it in the wrong process, the fork
+handlers will be invoked, too, of course.
Initialises and configures the fork watcher - it has no parameters of any
+kind. There is a ev_fork_set macro, but using it is utterly pointless,
+believe me.
Libev can be compiled with a variety of options, the most fundemantal is
+EV_MULTIPLICITY. This option determines wether (most) functions and
+callbacks have an initial struct ev_loop * argument.
To make it easier to write programs that cope with either variant, the +following macros are defined:
+EV_A, EV_A_This provides the loop argument for functions, if one is required ("ev
+loop argument"). The EV_A form is used when this is the sole argument,
+EV_A_ is used when other arguments are following. Example:
ev_unref (EV_A); + ev_timer_add (EV_A_ watcher); + ev_loop (EV_A_ 0); + ++
It assumes the variable loop of type struct ev_loop * is in scope,
+which is often provided by the following macro.
EV_P, EV_P_This provides the loop parameter for functions, if one is required ("ev
+loop parameter"). The EV_P form is used when this is the sole parameter,
+EV_P_ is used when other parameters are following. Example:
// this is how ev_unref is being declared + static void ev_unref (EV_P); + + // this is how you can declare your typical callback + static void cb (EV_P_ ev_timer *w, int revents) + ++
It declares a parameter loop of type struct ev_loop *, quite
+suitable for use with EV_A.
EV_DEFAULT, EV_DEFAULT_Similar to the other two macros, this gives you the value of the default +loop, if multiple loops are supported ("ev loop default").
+Example: Declare and initialise a check watcher, working regardless of +wether multiple loops are supported or not.
+ static void
+ check_cb (EV_P_ ev_timer *w, int revents)
+ {
+ ev_check_stop (EV_A_ w);
+ }
+
+ ev_check check;
+ ev_check_init (&check, check_cb);
+ ev_check_start (EV_DEFAULT_ &check);
+ ev_loop (EV_DEFAULT_ 0);
+
+
+
+
0, then they are not.
If undefined or defined to be 1, then stat watchers are supported. If
+defined to be 0, then they are not.
If undefined or defined to be 1, then fork watchers are supported. If
defined to be 0, then they are not.