In Programming with Libevent book, it says:
EV_TIMEOUT
This flag indicates an event that becomes active after a timeout elapses.
AFAIK, an event associate with socket fd will become active when network IO event is ready, which is notified by select/epoll/poll/kqueue.
If EV_TIMEOUT
make an event active, while the socket fd is not ready, will event_base do the callback ?
Or the socket fd is ready, while EV_TIMEOUT
is not, will event_base do the callback ?
Oh, I understand.
void (*event_callback_fn)(evutil_socket_t, short, void *);
The short
flag will tell callback what happened exactly.
When timeout, short & EV_TIMEOUT == true
, when socket is ready, short & (EV_READ | EV_WRITE) == true
.