After re-reading the doc, I tried with imap_unordered()
and it worked. So only the code of do_stuff()
needed to be altered and it now looks like this :
def do_stuff():
pool_size = 8
p = multiprocessing.Pool(pool_size)
p.imap_unordered(self.foo, range(pool_size))