ev_io

Marc Lehmann schmorp at schmorp.de
Sun Dec 7 16:43:31 CET 2008


On Sat, Dec 06, 2008 at 10:41:27PM +0200, Graham Leggett <minfrin at sharp.fm> wrote:
> What I have currently managed to get working is a combination of the  

Sounds sane to me.

> again if a modification to the file is detected. Reading the file in one  
> go won't work for me, as it will potentially block the event loop.

Reading the file will not block the event loop, but your program doing so
synchronously has no chance of calling it. It will do so regardless of
whether you read it in one go or not, the question is just for how long.

ev_stat can block the event loop itself, though (but is the only thing
that can do so).

> The target environment is Linux, which supports inotify, so in theory  
> there should be little or no delay once in live use.

ev_stat watchers can always block, even with inotify. The path could
for example be on an NFS filesystem and this could block the event loop
indefinitely. Even on local filesystems, it's relatively easy to block for
many seconds on a stat call, when the system is busy.

This is, however, explained in the documentation.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at goof.com
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list