[issue10527] multiprocessing.Pipe problem: "handle out of range in select()"

Richard Oudkerk report at bugs.python.org
Mon Oct 22 20:47:42 CEST 2012


Richard Oudkerk added the comment:

> Using poll() by default is controversial for 2 reasons, I think:
>
> #1 - a certain slowdown is likely to be introduced (I'll measure it)

With a single fd poll is a bit faster than select:

$ python -m timeit -s 'from select import select' 'select([0],[],[],0)'
100000 loops, best of 3: 2.99 usec per loop

$ python -m timeit -s 'from select import poll, POLLIN' 'p=poll();p.register(0,POLLIN);p.poll(0)'
100000 loops, best of 3: 2.8 usec per loop

The single fd case is the most important one -- see below.

> #2 - current wait() implementation allows to specify a list of file
> descriptors and/or Connections objects. 
> select() can deal with both while poll() does not (it will return a 
> list of integers rather than a list of Connection instances).
>
> I'm not sure how "public" multiprocessing.connection.wait() is 
> considered and how much backward compatibility should matter in this > case.

It was introduced in Python 3.3 and is only really there to allow cross platform Windows/Unix multiplexing.  It is (now) also used internally by Connection.poll() and Queue.get() with a single fd.

In retrospect it would probably have been better to have implemented poll style multiplexing on Windows.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10527>
_______________________________________


More information about the Python-bugs-list mailing list