--- libev/ev.pod 2011/12/20 01:47:49 1.387 +++ libev/ev.pod 2012/02/13 01:52:14 1.397 @@ -1880,7 +1880,7 @@ else { // callback was invoked, but there was some recent - // activity. simply restart the timer to time out + // activity. simply restart the timer to time out // after "after" seconds, which is the earliest time // the timeout can occur. ev_timer_set (w, after, 0.); @@ -2110,15 +2110,24 @@ =item ev_timer_again (loop, ev_timer *) -This will act as if the timer timed out and restarts it again if it is -repeating. The exact semantics are: +This will act as if the timer timed out, and restarts it again if it is +repeating. It basically works like calling C, updating the +timeout to the C value and calling C. -If the timer is pending, its pending status is cleared. +The exact semantics are as in the following rules, all of which will be +applied to the watcher: -If the timer is started but non-repeating, stop it (as if it timed out). +=over 4 + +=item If the timer is pending, the pending status is always cleared. + +=item If the timer is started but non-repeating, stop it (as if it timed +out, without invoking it). -If the timer is repeating, either start it if necessary (with the -C value), or reset the running timer to the C value. +=item If the timer is repeating, make the C value the new timeout +and start the timer, if necessary. + +=back This sounds a bit complicated, see L, above, for a usage example. @@ -3635,7 +3644,7 @@ while (!exit_main_loop) ev_run (EV_DEFAULT_ EVRUN_ONCE); - // in a model watcher + // in a modal watcher int exit_nested_loop = 0; while (!exit_nested_loop) @@ -3825,7 +3834,7 @@ That basically suspends the coroutine inside C and continues the libev coroutine, which, when appropriate, switches back to -this or any other coroutine. I am sure if you sue this your own :) +this or any other coroutine. You can do similar tricks if you have, say, threads with an event queue - instead of storing a coroutine, you store the queue object and instead of @@ -3910,6 +3919,10 @@ you need support for other types of functors please contact the author (preferably after implementing it). +For all this to work, your C++ compiler either has to use the same calling +conventions as your C compiler (for static member functions), or you have +to embed libev and compile libev itself as C++. + Here is a list of things available in the C namespace: =over 4 @@ -3928,7 +3941,7 @@ For each C watcher in F there is a corresponding class of the same name in the C namespace, with the exception of C which is called C to avoid clashes with the C macro -defines by many implementations. +defined by many implementations. All of those classes have these methods: @@ -4497,6 +4510,19 @@ be detected at runtime. If undefined, it will be enabled if the headers indicate GNU/Linux + Glibc 2.4 or newer, otherwise disabled. +=item EV_NO_SMP + +If defined to be C<1>, libev will assume that memory is always coherent +between threads, that is, threads can be used, but threads never run on +different cpus (or different cpu cores). This reduces dependencies +and makes libev faster. + +=item EV_NO_THREADS + +If defined to be C<1>, libev will assume that it will never be called +from different threads, which is a stronger assumption than C, +above. This reduces dependencies and makes libev faster. + =item EV_ATOMIC_T Libev requires an integer type (suitable for storing C<0> or C<1>) whose @@ -4654,6 +4680,20 @@ your program might be left out as well - a binary starting a timer and an I/O watcher then might come out at only 5Kb. +=item EV_API_STATIC + +If this symbol is defined (by default it is not), then all identifiers +will have static linkage. This means that libev will not export any +identifiers, and you cannot link against libev anymore. This can be useful +when you embed libev, only want to use libev functions in a single file, +and do not want its identifiers to be visible. + +To use this, define C and include F in the file that +wants to use libev. + +This option only works when libev is compiled with a C compiler, as C++ +doesn't support the required declaration syntax. + =item EV_AVOID_STDIO If this is set to C<1> at compiletime, then libev will avoid using stdio