First, you'll want to exit from each forked copy, or else it will reach
the code-after-the-for-loop:
import sys, os, time
texts = ['this is text1', 'this is text 2']
for current_text in texts[0:]:
pid = os.fork()
if pid == 0:
time.sleep(2)
print current_text
raise SystemExit
Next, you'll want to wait for each process you started:
for current_text in texts:
os.waitpid(-1, 0)
print 'this is the end'
$ python /tmp/franz.py
this is text1
this is text 2
this is the end
Jeff
pgp37vjgFm0zM.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list
