0

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 ?

jww
  • 97,681
  • 90
  • 411
  • 885
linrongbin
  • 2,967
  • 6
  • 31
  • 59

1 Answers1

0

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.

jww
  • 97,681
  • 90
  • 411
  • 885
linrongbin
  • 2,967
  • 6
  • 31
  • 59