Skip to content

Commit

Permalink
unix/modselect: Remove unix-specific implementation of select module.
Browse files Browse the repository at this point in the history
The unix port has a custom select module which only works with objects that
have a file descriptor, eg files and sockets.  On the other hand, bare
metal ports use the common extmod/modselect.c implementation of the select
module that supports polling of arbitrary objects, as long as those objects
provide a MP_STREAM_POLL in their ioctl implementation (which can be done
in C or Python).

This commit removes the unix-specific code and makes unix use the common
one provided by extmod/modselect.c instead.  All objects with file
descriptors implement MP_STREAM_POLL so they continue to work.

Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Aug 7, 2023
1 parent 22106bf commit df08c38
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 365 deletions.
1 change: 0 additions & 1 deletion ports/unix/Makefile
Expand Up @@ -201,7 +201,6 @@ SRC_C += \
mpthreadport.c \
input.c \
modmachine.c \
modselect.c \
alloc.c \
fatfs_port.c \
mpbthciport.c \
Expand Down
356 changes: 0 additions & 356 deletions ports/unix/modselect.c

This file was deleted.

10 changes: 2 additions & 8 deletions ports/unix/variants/mpconfigvariant_common.h
Expand Up @@ -106,14 +106,8 @@
#define MICROPY_PY_CRYPTOLIB (1)
#endif

// Use the posix implementation of the "select" module (unless the variant
// specifically asks for the MicroPython version).
#ifndef MICROPY_PY_SELECT
#define MICROPY_PY_SELECT (0)
#endif
#ifndef MICROPY_PY_SELECT_POSIX
#define MICROPY_PY_SELECT_POSIX (!MICROPY_PY_SELECT)
#endif
// The "select" module is enabled by default, but disable select.select().
#define MICROPY_PY_SELECT_SELECT (0)

// Enable the "websocket" module.
#define MICROPY_PY_WEBSOCKET (1)
Expand Down

0 comments on commit df08c38

Please sign in to comment.