Author pitrou
Recipients Albert.Strasheim, aljungberg, asksol, bquinlan, gdb, hongqn, jnoller, pitrou, vlasovskikh, vstinner
Date 2011-03-31.13:05:29
SpamBayes Score 4.32971e-06
Marked as misclassified No
Message-id <1301576730.65.0.264943424486.issue9205@psf.upfronthosting.co.za>
In-reply-to
Content
Possible plan for POSIX, where a connection uses a pipe() or socketpair(): exploit the fact that an endpoint becomes ready for reading (indicating EOF) when the other endpoint is closed:

>>> r, w = os.pipe()
>>> select.select([r], [], [r], 0)
([], [], [])
>>> os.close(w)
>>> select.select([r], [], [r], 0)
([4], [], [])

>>> a, b = socket.socketpair()
>>> select.select([b], [], [b], 0)
([], [], [])
>>> a.close()
>>> select.select([b], [], [b], 0)
([<socket.socket object, fd=8, family=1, type=1, proto=0>], [], [])

So, each Process could have a sentinel fd in the parent process, which becomes ready when the process exits. These sentinel fds can be used in the various select() calls underlying Queue.get().

(I don't understand why _multiprocessing/socket_connection.c in written in C. Rewriting it in Python would make improvements much easier)
History
Date User Action Args
2011-03-31 13:05:30pitrousetrecipients: + pitrou, bquinlan, vstinner, jnoller, hongqn, asksol, vlasovskikh, gdb, Albert.Strasheim, aljungberg
2011-03-31 13:05:30pitrousetmessageid: <1301576730.65.0.264943424486.issue9205@psf.upfronthosting.co.za>
2011-03-31 13:05:29pitroulinkissue9205 messages
2011-03-31 13:05:29pitroucreate