<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
Adam Tauno Williams wrote:<br>
<br>
[...]<br>
<blockquote cite="mid:1263918409.3165.15.camel@linux-m3mt" type="cite">
<blockquote type="cite">
<pre wrap="">Here's the guts of my latest incarnation.
def ProcessBatch(files):
p = []
for file in files:
p.append(Process(target=ProcessFile,args=file))
for x in p:
x.start()
for x in p:
x.join()
p = []
return
Now, the function calling ProcessBatch looks like this:
def ReplaceIt(files):
processFiles = []
for replacefile in files:
if(CheckSkipFile(replacefile)):
processFiles.append(replacefile)
if(len(processFiles) == 4):
ProcessBatch(processFiles)
processFiles = []
#check for left over files once main loop is done and process them
if(len(processFiles) > 0):
ProcessBatch(processFiles)
</pre>
</blockquote>
<pre wrap=""><!---->
According to this you will create files is sets of four, but an unknown
number of sets of four.
</pre>
</blockquote>
This is not correct, 'cause of the x.join(). This will block the parent
process until all processes have been terminated. So as soon as the
current set of processes have finished their job, a new set will be
spawned.<br>
<br>
Cheers,<br>
Nils<br>
</body>
</html>