From 4869f7e4e023a802c535a036011083ff425d7fec Mon Sep 17 00:00:00 2001 From: root Date: Tue, 6 May 2008 23:34:16 +0000 Subject: *** empty log message *** --- Changes | 4 ++- ev.c | 4 ++- ev.pod | 119 ++++++++++++++++++++++++++++++++++++++++++---------------------- 3 files changed, 84 insertions(+), 43 deletions(-) diff --git a/Changes b/Changes index 9f2e296..0e7d962 100644 --- a/Changes +++ b/Changes @@ -4,7 +4,9 @@ Revision history for libev, a high-performance and full-featured event loop. for better cache-efficiency and increases memory requirements by up to two pointers/loop. - fix a potential aliasing issue in ev_timer_again. - - add/document ev_periodic_at, retract diretc access to ->at. + - add/document ev_periodic_at, retract direct access to ->at. + - improve ev_stat docs. + - add portability requirements section. 3.31 Wed Apr 16 20:45:04 CEST 2008 - added last minute fix for ev_poll.c by Brandon Black. diff --git a/ev.c b/ev.c index 4065b99..058d7ee 100644 --- a/ev.c +++ b/ev.c @@ -522,7 +522,7 @@ ev_sleep (ev_tstamp delay) /*****************************************************************************/ -#define MALLOC_ROUND 4096 // prefer to allocate in chunks of this size, must be 2**n and >> 4 longs +#define MALLOC_ROUND 4096 /* prefer to allocate in chunks of this size, must be 2**n and >> 4 longs */ int inline_size array_nextsize (int elem, int cur, int cnt) @@ -2118,6 +2118,8 @@ infy_add (EV_P_ ev_stat *w) ev_timer_start (EV_A_ &w->timer); /* this is not race-free, so we still need to recheck periodically */ /* monitor some parent directory for speedup hints */ + /* note that exceeding the hardcoded limit is not a correctness issue, */ + /* but an efficiency issue only */ if ((errno == ENOENT || errno == EACCES) && strlen (w->path) < 4096) { char path [4096]; diff --git a/ev.pod b/ev.pod index 6ae53b1..0f0b2e3 100644 --- a/ev.pod +++ b/ev.pod @@ -1612,11 +1612,12 @@ resource-intensive. At the time of this writing, only the Linux inotify interface is implemented (implementing kqueue support is left as an exercise for the -reader). Inotify will be used to give hints only and should not change the -semantics of C watchers, which means that libev sometimes needs -to fall back to regular polling again even with inotify, but changes are -usually detected immediately, and if the file exists there will be no -polling. +reader, note, however, that the author sees no way of implementing ev_stat +semantics with kqueue). Inotify will be used to give hints only and should +not change the semantics of C watchers, which means that libev +sometimes needs to fall back to regular polling again even with inotify, +but changes are usually detected immediately, and if the file exists there +will be no polling. =head3 ABI Issues (Largefile Support) @@ -1651,16 +1652,25 @@ The C syscall only supports full-second resolution portably, and even on systems where the resolution is higher, many filesystems still only support whole seconds. -That means that, if the time is the only thing that changes, you might -miss updates: on the first update, C detects a change and calls -your callback, which does something. When there is another update within -the same second, C will be unable to detect it. - -The solution to this is to delay acting on a change for a second (or till -the next second boundary), using a roughly one-second delay C -(C). The C<.01> -is added to work around small timing inconsistencies of some operating -systems. +That means that, if the time is the only thing that changes, you can +easily miss updates: on the first update, C detects a change and +calls your callback, which does something. When there is another update +within the same second, C will be unable to detect it as the stat +data does not change. + +The solution to this is to delay acting on a change for slightly more +than second (or till slightly after the next full second boundary), using +a roughly one-second-delay C (e.g. C). + +The C<.02> offset is added to work around small timing inconsistencies +of some operating systems (where the second counter of the current time +might be be delayed. One such system is the Linux kernel, where a call to +C might return a timestamp with a full second later than +a subsequent C