[issue5573] multiprocessing Pipe poll() and recv() semantics.

Vaibhav Mallya report at bugs.python.org
Thu Mar 26 20:38:33 CET 2009


New submission from Vaibhav Mallya <mallyvai at umich.edu>:

Python 2.6.1 (r261:67515, Mar 22 2009, 05:39:39) 
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing import Pipe
>>> parent, child = Pipe()
>>> parent.send(1)
>>> parent.close()
>>> print child.recv()
1
>>> print child.poll()
True
>>> print child.recv()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
EOFError

We have to use both poll() and recv() to determine whether or not the
connection was actually closed.

Better behavior might be returning True on poll() only if the next
recv() on that end of the pipe will work without an error. There may not
be a way to guarantee this, but it would be useful if the documentation
was clarified either way.


uname -a:
Linux mememy 2.6.24-23-generic #1 SMP Thu Feb 5 15:00:25 UTC 2009 i686
GNU/Linux

Compiled Python 2.6.1 from source.

----------
assignee: georg.brandl
components: Documentation, Library (Lib)
messages: 84204
nosy: georg.brandl, mallyvai
severity: normal
status: open
title: multiprocessing Pipe poll() and recv() semantics.
type: behavior
versions: Python 2.6

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


More information about the Python-bugs-list mailing list