Re: epoll reporting events when it hasn't been asked to

Davide Libenzi
2004-04-01T19:29:58Z

On Thu, 1 Apr 2004, Ben Mansell wrote:

> > It is a feature. epoll OR user events with POLLHUP|POLLERR so that even if
> > the user sets the event mask to zero, it can still know when something
> > like those abnormal condition happened. Which problem do you see with this?
>
> What should the application do if it gets events that it didn't ask for?
> If you choose to ignore them, the next time epoll_wait() is called it
> will return instantly with these same messages, so the app will spin and
> eat CPU.

Shouldn't the application handle those exceptional conditions instead of
ignoring them?

> Perhaps it should only OR the user event with POLLHUP|POLLERR if
> POLLIN or POLLOUT is set?

This can certainly be done, since it's a one-liner fix. I'm not sure if it
is the correct behaviour. Anyone else?

- Davide