On Sat, 25 Dec 2004 08:20:24 -0600
Jeff Epler <[EMAIL PROTECTED]> wrote:
> 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'
This can eventually die with exception. The proper way is:
try:
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 c