Asyncio Queue implementation suggestion

Léo El Amri leo at superlel.me
Thu Sep 17 11:53:01 EDT 2020


On 17/09/2020 16:51, Dennis Lee Bieber wrote:
> On Wed, 16 Sep 2020 13:39:51 -0400, Alberto Sentieri <22t at tripolho.com>
> declaimed the following:
> 
>> devices tested simultaneously, I soon run out of file descriptor. Well, 
>> I increased the number of file descriptor in the application and then I 
>> started running into problems like “ValueError: filedescriptor out of 
>> range in select()”. I guess this problem is related to a package called 
> 
> https://man7.org/linux/man-pages/man2/select.2.html
> """
> An fd_set is a fixed size buffer. 
> """
> and
> """
> On success, select() and pselect() return the number of file
>        descriptors contained in the three returned descriptor sets (that
> is,
>        the total number of bits that are set in readfds, writefds,
>        exceptfds).
> """
> Emphasis "number of bits that are set" -- the two together implies that
> these are words/longwords/quadwords used a bitmaps, one fd per bit, and
> hence inherently limited to only as many bits as the word-length supports.

By the way, Alberto, you can change the selector used by your event loop
by instantiating the loop class by yourself [1]. You may want to use
selectors.PollSelector [2].

[1]
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.SelectorEventLoop
[2] https://docs.python.org/3/library/selectors.html#selectors.PollSelector

- Léo


More information about the Python-list mailing list