I have main thread where I created ThreadPool. Before call function, makes initialization each thread in pool. How wait when all threads will be initialized?
Example:
from multiprocessing.pool import ThreadPool
def main():
# in main thread
pool = ThreadPool(processes=5, initializer=init_pool)
# >>> here it is I want to wait for initialized
pool.map_async(do_smth).get()
def init_pool():
# initialized new thread in pool
pass
def do_smth():
# do somethings
pass
It is necessary not to cause map_async if initialization of a thread exception occurred