minfrin at sharp.fm
Sat Dec 6 01:33:02 CET 2008
I am having a hassle with the ev_io watcher, I suspect I am not
understanding how this works.
I set up a callback on a file that must run when the file is readable,
ev_io_init(&t->io.io, watch_tail_reader_cb, t->handle, EV_READ);
The callback is called, and in the callback, the file is read, until I
reach the end of the file, at which point my attempts to read return
size 0, which I understand to mean EOF.
The problem is, despite the EOF point in the file having been reach,
socket remains readable, and the event still fires off in a tight loop,
eating up 100% CPU.
I am trying to tail the file, so telling the event to stop watching the
file for reads means that I will miss any writes a third party makes to
Am I understanding this correctly, or does a file report itself as
repeatedly readable when the pointer reaches the end of the file?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3287 bytes
Desc: S/MIME Cryptographic Signature
More information about the libev