ev_io
Graham Leggett
minfrin at sharp.fm
Sat Dec 6 01:33:02 CET 2008
Hi all,
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,
like this:
ev_io_init(&t->io.io, watch_tail_reader_cb, t->handle, EV_READ);
ev_io_start(t->s->e->loop, &t->io.io);
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
the file.
Am I understanding this correctly, or does a file report itself as
repeatedly readable when the pointer reaches the end of the file?
Regards,
Graham
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3287 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20081206/fa440560/attachment.bin>
More information about the libev
mailing list