[Python-Dev] Adding poll() system call

Andrew Kuchling akuchlin@mems-exchange.org
Tue, 11 Jul 2000 09:54:43 -0400


On Thu, Jul 06, 2000 at 02:16:07PM -0700, Ka-Ping Yee quoted me:
>> I'd suggest adding poll() to 2.0, and will submit a patch if given the
>> go-ahead.  But where should it go?  A whole module for it seems
>> excessive; should it go in posixmodule, or maybe select?

I've completed a patch, SF#100852, to add os.poll() based on Sam
Rushing's code with various modifications; I'd like a reviewer to look
it over, after which I'll check it in.

http://sourceforge.net/patch/?func=detailpatch&patch_id=100852&group_id=5470

I'm not happy with the interface -- you pass in a list of (file
descriptor, event mask) 2-tuples -- but it seems the only way to
expose all of poll()'s functionality.  I thought about allowing a lone
file descriptor as well as a tuple, in which you'd assume an event
mask of POLLIN | POLLPRI | POLLOUT (all the common events), but it
seemed like too much magic.

Also, is there a C utility function to handle the "pass an integer or
an object with a fileno() method" protocol for me?  Should there be
one?

--amk