POSIX poll() requires file events to be received when they are sent before registering
The relibc implementation of POSIX poll()
registers for events on each poll call. With the current implementation of the Event scheme, events are only received by the waiter if they occurred after registration. This means that poll()
is often going to miss events, especially when using timeouts.
The proposed solution is that events on file descriptors (FEVENT
) should be held in the kernel until read. So the event scheme would need to
- maintain a list of file descriptors with pending events
- merge FEVENT's when more than one is pending on the same descriptor (one for READ, one for WRITE)
- clear the event when it is read
- discard pending events when the file descriptor is closed
An alternative solution is for poll()
to first register, then to request all events being monitored be resent.
Edited by Ron Williams