[Python-Dev] epoll implementation
rcohen at snurgle.org
Fri May 26 19:31:33 CEST 2006
On Fri, May 26, 2006 at 01:10:30PM -0400, Jean-Paul Calderone wrote:
> Including a wrapper for this functionality would be quite useful for many python network apps. However, I think with ctypes going into 2.5, it might be better to consider providing epoll support using a ctypes-based module rather than an extension module.
I have to admit that I wrote this for python 2.4 and haven't yet educated
myself on ctypes. If this is what's desired I can put some energy into it.
However, the PyEpoll module is largely a modified version of the python 2.4
> Of course, if there is a volunteer to maintain and support an extension module, that's better than nothing. PyEpoll is missing a couple features I would like to see - the size of the epoll set is hard-coded to FD_SETSIZE, for example: while this makes little difference to Python 2.4.3 (since you cannot use sockets with fileno >= FD_SETSIZE at all in that version of Python), it is a serious limitation for other versions of Python. Similarly, the number of events to retrieve when invoking epoll_wait() is also hardcoded to FD_SETSIZE. Real applications often want to tune this value to avoid being overwhelmed by io events.
It is not true that this module limits the number of file descriptors to
FD_SETSIZE. You were probable looking at the number of file descriptors
returned by the epoll call, which is already limited by FD_SETSIZE because
of the size of event array. In any case, this can be made tunable.
> Of course the other standard things should be added as well - documentation and test coverage, neither of which seem to be present at all in PyEpoll.
Like I said, this code is a modified version of the python select module.
It should (I hope, unless I accidentally removed some) include all the
documentation from there, and any test cases for that module will apply
here. The API provided to python programs has not changed, only the backend
implementation of the API. My hope is that this can be included as a
compile-time option for the select module instead of being its own module.
More information about the Python-Dev