I am trying to implement parallel processing with os.fork.. However i want
to collect results from each process.. I thought i could use Queues, but i
cant seem to get it work. Threading, can not work for me, because of the way
some functions have been written -
Below is a copy of what i had written..
cheers
Jojo
---------------------------------
import os, time, Queue
import do_something
mylist1 = [item1, item2, item3 ......]
mylist2 = [item1,item2, item2 ......]
def child(x, y):
return do_something(x,y)
def parent(myqueue):
for x, y in zip (mylist1, mylist2):
pid = os.fork()
if pid !=0:
print 'Process %d spwaned' %pid
else:
result = child(x, y)
sys.exit(0)
myqueue.put(result)
return myqueue
myqueue = Queue.Queue(0)
data = parent(myqueue)
---------------------------
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor