Hi,

 I'm writing a daemon using libevent. The daemon is started like this:
"program_A | daemon"
It gets a pipe on standard input. The program_A is writing to this pipe and the 
daemon must process the input gathered from the pipe. I must be doing something 
wrong as my callback function set in event_set is called nonstop. A trace had 
shown that epoll_wait() in epoll_dispatch() is not waiting at all and 
afterwards the read() in the callback returns always 0. When I start the daemon 
like this "./daemon" and write on the console, it all works fine as it should.

Here is my daemon skeleton:

struct event ev;

void read_stdin (int fd, short flags, void *data)
{
 ..
 ret = read(fd, buf, BUFSIZE);
 ..
}

main ()
{
 base = event_init();
 event_set(&ev, 0, EV_READ | EV_PERSIST, read_stdin, NULL);
 event_add(&ev, NULL);
 event_base_loop(base, 0);
}


Thanks for any advice in advanced,
Tom
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to