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
--

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to