ef71028f77
A previous commit removed the unix-specific select module implementation and made unix use the common one. This commit adds an optimisation so that the system poll function is used when polling objects that have a file descriptor. With this optimisation enabled, if code registers both file-descriptor-based objects, and non- file-descriptor-based objects with select.poll() then the following occurs: - the system poll is called for all file-descriptor-based objects with a timeout of 1ms - then the bare-metal polling implementation is used for remaining objects, which calls into their ioctl method (which can be in C or Python) In the case where all objects have file descriptors, the system poll is called with the full timeout requested by the caller. That makes it as efficient as possible in the case everything has a file descriptor. Benefits of this approach: - all ports use the same select module implementation - the unix port now supports polling of all objects and matches bare metal implementations - it's still efficient for existing cases where only files and sockets are polled (on unix) - the bare metal implementation does not change - polling of SSL objects will now work on unix by calling in to the ioctl method on SSL objects (this is required for asyncio ssl support) Note that extmod/vfs_posix_file.c has poll disable when the optimisation is enabled, because the code is not reachable when the optimisation is used. Signed-off-by: Damien George <damien@micropython.org> |
||
---|---|---|
.. | ||
bare-arm | ||
cc3200 | ||
embed | ||
esp32 | ||
esp8266 | ||
mimxrt | ||
minimal | ||
nrf | ||
pic16bit | ||
powerpc | ||
qemu-arm | ||
renesas-ra | ||
rp2 | ||
samd | ||
stm32 | ||
teensy | ||
unix | ||
webassembly | ||
windows | ||
zephyr |