3

Suppose I am specifying both EPOLLIN and EPOLLOUT flags when adding descriptors to monitor with epoll_wait. From the 'epoll' manpages it is unclear what exactly each of the epoll_event structures returned as part of the array carries in its events field. Quoting:

the events member will contain the returned event bit field.

Does it mean that it is impossible to distinguish whether an event was triggered signifying 'can-write' as opposed to 'can-read'? Basically there is an event mask, and I would logically expect returned array to signify exactly what event(s) have 'happened' on a file descriptor?

Josh Paul
  • 76
  • 5
Armen Michaeli
  • 8,625
  • 8
  • 58
  • 95

1 Answers1

4

Your expectation is right. The events member will contain the event(s) that have occured for that file descriptor.

caf
  • 233,326
  • 40
  • 323
  • 462
  • 1
    is it possible for `events` to contain both `EPOLLIN` and `EPOLLOUT` mask? – compile-fan Jun 18 '11 at 03:24
  • 2
    @compile-fan: Yes. Consider level-triggering where the file descriptor is already readable and writeable when it is polled. – caf Jun 19 '11 at 13:12