[New-bugs-announce] [issue35517] enhhance for selector.EpollSelector

Manjusaka report at bugs.python.org
Mon Dec 17 05:31:38 EST 2018


New submission from Manjusaka <lizheao940510 at gmail.com>:

Add a keyword argument for selector.EpollSelector with default value.

This can help people use the EPOLLEXCLUSIVE since Python 3.7 and Linux Kernel 4.5 to avoid the herd effect

like this

        def register(self, fileobj, events, data=None, exclusive=False):
            key = super().register(fileobj, events, data)
            epoll_events = 0
            if events & EVENT_READ:
                epoll_events |= select.EPOLLIN
            if events & EVENT_WRITE:
                epoll_events |= select.EPOLLOUT
            try:
                if exclusive and hasattr(select, "EPOLLEXCLUSIVE"):
                    epoll_events |= select.EPOLLEXCLUSIVE
                self._epoll.register(key.fd, epoll_events)
            except BaseException:
                super().unregister(fileobj)
                raise
            return key

----------
components: Library (Lib)
messages: 331969
nosy: Manjusaka
priority: normal
severity: normal
status: open
title: enhhance for selector.EpollSelector
type: enhancement
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35517>
_______________________________________


More information about the New-bugs-announce mailing list