I'm writing a program and use libevent.
I add an event
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 10000;
...
...
event_set(&ev, fd, EV_READ|EV_TIMEOUT|EV_PERSIST, callback, NULL);
event_add(&ev, &tv);
but I notice that if I replace &tv with NULL
, namely I don't want a timeout event, then the program works fine, the event ev
is triggered when the fd
is readable, however, if it is &tv
not NULL, the event is only triggered for the first time when fd
is readable.
What is the reason for this? is it that the timeout value is too small? what is the minimum timeout value for libevent, epoll, select. etc?
thanks!