1.1 --- a/parallel.py Wed Sep 28 15:56:36 2005 +0000
1.2 +++ b/parallel.py Wed Sep 28 16:00:06 2005 +0000
1.3 @@ -93,7 +93,6 @@
1.4 import sys
1.5 import select
1.6 import socket
1.7 -#from signal import signal, SIGCHLD
1.8
1.9 try:
1.10 import cPickle as pickle
1.11 @@ -225,20 +224,17 @@
1.12 creating process and the created process.
1.13 """
1.14
1.15 - parent_read, child_write = socket.socketpair()
1.16 - child_read, parent_write = socket.socketpair()
1.17 - for s in [parent_read, child_write, child_read, parent_write]:
1.18 + parent, child = socket.socketpair()
1.19 + for s in [parent, child]:
1.20 s.setblocking(1)
1.21
1.22 pid = os.fork()
1.23 if pid == 0:
1.24 - parent_read.close()
1.25 - parent_write.close()
1.26 - return Channel(pid, child_read.makefile("r"), child_write.makefile("w"))
1.27 + parent.close()
1.28 + return Channel(pid, child.makefile("r"), child.makefile("w"))
1.29 else:
1.30 - child_read.close()
1.31 - child_write.close()
1.32 - return Channel(pid, parent_read.makefile("r"), parent_write.makefile("w"))
1.33 + child.close()
1.34 + return Channel(pid, parent.makefile("r"), parent.makefile("w"))
1.35
1.36 def start(callable, *args, **kwargs):
1.37
1.38 @@ -264,11 +260,4 @@
1.39 else:
1.40 return channel
1.41
1.42 -# Define and install a handler which waits for terminated child processes.
1.43 -
1.44 -#def handler(number, frame):
1.45 -# os.wait()
1.46 -
1.47 -#signal(SIGCHLD, handler)
1.48 -
1.49 # vim: tabstop=4 expandtab shiftwidth=4