diff --git a/common/threadpool.py b/common/threadpool.py index e2d45c43d3bef2b24cd7d634f2d7b18887b59a2b..a4d9fd76f246b5d8426f139d437990903c22d94a 100644 --- a/common/threadpool.py +++ b/common/threadpool.py @@ -3,7 +3,7 @@ # cython:language_level=3 import functools -from concurrent.futures import ThreadPoolExecutor +from concurrent.futures import ThreadPoolExecutor, as_completed from common.log import Logger from common.decorator_wrap import DecoratorWrap @@ -35,4 +35,14 @@ class ThreadPool(): else: Logger().debug("no child thread working") return False - \ No newline at end of file + + def thread_finish(self): + ''' + Return the result after waiting for all threads to finish executing + ''' + data = '' + for future in as_completed(self.__generate_list): + data = future.result() + + Logger().debug("Thread task execution ends {} ".format(data)) + \ No newline at end of file