Does `epoll_wait` signify which event was triggered when both EPOLLIN and EPOLLOUT were added?

StackOverflow https://stackoverflow.com/questions/4817015

  •  25-10-2019
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top