[WIP] bpo-28708: Add setsize keywoard-only parameter to select.select()#13845
[WIP] bpo-28708: Add setsize keywoard-only parameter to select.select()#13845vstinner wants to merge 1 commit into
Conversation
It becomes possible to configure the set size used internally by select.select() at runtime.
|
I have no idea if this PR works :-) Is it really possible to change FD_SETSIZE at runtime? |
| pylist efd2obj[FD_SETSIZE + 1]; | ||
| #endif /* SELECT_USES_HEAP */ | ||
| PyObject *ret = NULL; | ||
| fd_set ifdset, ofdset, efdset; |
There was a problem hiding this comment.
I think these three sets will need to be allocated differently. We'll probably need a different fd_set structure something like:
typedef struct fd_set_2
{
u_int fd_count
SOCKET *fd_array;
} fd_set_2;
and then dynamically allocate the fd_array to be a SOCKET* array of size set_size.
Knowing that the select implementation only looks at the fd_count for the size of the array (and doesn't do any boundary checking), we can cast those sets to fd_set and then pass them to the select call.
There was a problem hiding this comment.
Actually that struct type isn't going to work, because that adds a level of indirection that the select implementation doesn't expect.
We'll need to allocate a continuous area of memory of size (sizeof(u_int) + setsize*sizeof(SOCKET))
It becomes possible to configure the set size used internally by
select.select() at runtime.
https://bugs.python.org/issue28708