From cc1c382b0071981b0f3a1cc518dbcab97710b06a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 16 Mar 2010 20:32:20 +0000 Subject: *** empty log message *** --- Changes | 1 + ev.h | 12 +++++++++--- ev.pod | 50 ++++++++++++++++++++++++++++++++++++-------------- ev_vars.h | 2 +- 4 files changed, 47 insertions(+), 18 deletions(-) diff --git a/Changes b/Changes index 53ab312..6e095aa 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ Revision history for libev, a high-performance and full-featured event loop. TODO: ABI??? API????? Changes??? TODO: win32 write() to socket for signal handling +TODO: ev_loop_xx => ev_xx - ev_embed_stop did not correctly stop the watcher (very good testcase by Vladimir Timofeev). - applied win32 fixes by Michael Lenaghan (also James Mansion). diff --git a/ev.h b/ev.h index 97b7064..16e175b 100644 --- a/ev.h +++ b/ev.h @@ -590,9 +590,15 @@ void ev_unref (EV_P); void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg); # if EV_FEATURE_API -unsigned int ev_loop_count (EV_P); /* number of loop iterations */ -unsigned int ev_loop_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */ -void ev_loop_verify (EV_P); /* abort if loop data corrupted */ +unsigned int ev_iteration (EV_P); /* number of loop iterations */ +unsigned int ev_depth (EV_P); /* #ev_loop enters - #ev_loop leaves */ +void ev_verify (EV_P); /* abort if loop data corrupted */ + +/* pre 4.0 API */ +# if EV_MULTIPLICITY +# define ev_loop_count(l) ev_iteration (l) +# define ev_loop_depth(l) ev_depth (l) +# endif void ev_set_io_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */ void ev_set_timeout_collect_interval (EV_P_ ev_tstamp interval); /* sleep at least this time, default 0 */ diff --git a/ev.pod b/ev.pod index 88340ac..0cfd949 100644 --- a/ev.pod +++ b/ev.pod @@ -347,9 +347,8 @@ around bugs. =item C -Instead of calling C or C manually after -a fork, you can also make libev check for a fork in each iteration by -enabling this flag. +Instead of calling C manually after a fork, you can also +make libev check for a fork in each iteration by enabling this flag. This works by calling C on every iteration of the loop, and thus this might slow down your event loop if you do a lot of loop @@ -613,9 +612,15 @@ the child process (or both child and parent, but that again makes little sense). You I call it in the child before using any of the libev functions, and it will only take effect at the next C iteration. +Again, you I to call it on I loop that you want to re-use after +a fork, I. This is +because some kernel interfaces *cough* I *cough* do funny things +during fork. + On the other hand, you only need to call this function in the child -process if and only if you want to use the event library in the child. If -you just fork+exec, you don't have to call it at all. +process if and only if you want to use the event loop in the child. If you +just fork+exec or create a new loop in the child, you don't have to call +it at all. The function itself is quite fast and it's usually not a problem to call it just in case after a fork. To make this easy, the function will fit in @@ -627,25 +632,26 @@ quite nicely into a call to C: Like C, but acts on an event loop created by C. Yes, you have to call this on every allocated event loop -after fork that you want to re-use in the child, and how you do this is -entirely your own problem. +after fork that you want to re-use in the child, and how you keep track of +them is entirely your own problem. =item int ev_is_default_loop (loop) Returns true when the given loop is, in fact, the default loop, and false otherwise. -=item unsigned int ev_loop_count (loop) +=item unsigned int ev_iteration (loop) -Returns the count of loop iterations for the loop, which is identical to +Returns the current iteration count for the loop, which is identical to the number of times libev did poll for new events. It starts at C<0> and happily wraps around with enough iterations. This value can sometimes be useful as a generation counter of sorts (it "ticks" the number of loop iterations), as it roughly corresponds with -C and C calls. +C and C calls - and is incremented between the +prepare and check phases. -=item unsigned int ev_loop_depth (loop) +=item unsigned int ev_depth (loop) Returns the number of times C was entered minus the number of times C was exited, in other words, the recursion depth. @@ -655,7 +661,8 @@ C<1>, unless C was invoked recursively (or from another thread), in which case it is higher. Leaving C abnormally (setjmp/longjmp, cancelling the thread -etc.), doesn't count as exit. +etc.), doesn't count as "exit" - consider this as a hint to avoid such +ungentleman behaviour unless it's really convenient. =item unsigned int ev_backend (loop) @@ -4620,13 +4627,28 @@ involves iterating over all running async watchers or all signal numbers. =back -=head1 PORTING FROM 3.X TO 4.X +=head1 PORTING FROM LIBEV 3.X TO 4.X The major version 4 introduced some minor incompatible changes to the API. +At the moment, the C header file tries to implement superficial +compatibility, so most programs should still compile. Those might be +removed in later versions of libev, so better update early than late. + =over 4 -=item C replaced by C in C +=item C renamed to C + +=item C renamed to C + +=item C renamed to C + +Most functions working on C objects don't have an +C prefix, so it was removed. Note that C is +still called C because it would otherwise clash with the +C typedef. + +=item C renamed to C in C This is a simple rename - all other watcher types use their name as revents flag, and now C does, too. diff --git a/ev_vars.h b/ev_vars.h index e5f99e4..5be204e 100644 --- a/ev_vars.h +++ b/ev_vars.h @@ -1,7 +1,7 @@ /* * loop member variable declarations * - * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann + * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann * All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- -- cgit v1.2.3