[issue1657] [patch] epoll and kqueue wrappers for the select module

Christian Heimes report at bugs.python.org
Sat Dec 22 12:09:05 CET 2007


Christian Heimes added the comment:

> I attached a patch with a more complete test of kqueue. It's not that
> great, but it's a thing. I've only tested on OS X, but it works.
   
A small unit test is better than no unit test :)

> Regarding the ability of building an epoll object from a fd, it might be
> usefull in some corner cases, but that's not a priority.
>   

It should be trivial to add an epoll.fromfd() classmethod.

> exarkun looked at the patch and told me that there may be some
> threadsafety issues: for example, when calling epoll_wait, you use
> self->evs unprotected. It's not very important, but you may want to tell
> it in the documentation.
   

I found an interesting article about epoll. It states that epoll_wait() 
is thread safe. Ready lists of two parallel threds never contain the 
same fd.
http://lwn.net/Articles/224240/
It's easier to remove the buffer and allocate memory inside the wait() 
method than to add semaphores. It makes the code.

> As you started the rich comparison for kevent objects, it may be
> interesting to have full comparison (to sort list of events). It's not a
> high priority though.

What do you suggest as sort criteria?

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1657>
__________________________________


More information about the Python-bugs-list mailing list