Feature #12902
closedepoll should nominally support EPOLLEXCLUSIVE
100%
Description
As of version 4.5, Linux as supported the EPOLLEXCLUSIVE
flag on events. The man page describes it as such:
Sets an exclusive wakeup mode for the epoll file descriptor that is being attached to the target file descriptor, fd. When a wakeup event occurs and multiple epoll file descriptors are attached to the same target file using
EPOLLEXCLUSIVE
, one or more of the epoll file descriptors will receive an event withepoll_wait(2)
. The default in this scenario (whenEPOLLEXCLUSIVE
is not set) is for all epoll file descriptors to receive an event.EPOLLEXCLUSIVE
is thus useful for avoiding thundering herd problems in certain scenarios.If the same file descriptor is in multiple epoll instances, some with the EPOLLEXCLUSIVE flag, and others without, then events will be provided to all epoll instances that did not specify EPOLLEXCLUSIVE, and at least one of the epoll instances that did specify EPOLLEXCLUSIVE.
That final sentence gives us an escape hatch, since it seems that implementing EPOLLEXCLUSIVE
as a no-op would still be correct within the semantics.
Until someone is compelled to implement the full functionality, we should at least provide the same header definition and error handling . (Later parts of the man page describe extra input verification with EPOLLEXCLUSIVE
set.)