I\'m writing a program that will watch a particular directory for new files containing download URLs. Once a new file is detected, it will create a new process to do the act
You can set up a separate thread which does the joining. Have it listen on a queue into which you push the subprocess handles:
class Joiner(Thread):
def __init__(self, q):
self.__q = q
def run(self):
while True:
child = self.__q.get()
if child == None:
return
child.join()
Then, instead of p.join(), do joinq.put(p) and do a joinq.put(None) to signal the thread to stop. Make sure you use a FIFO queue.