12 lines
313 B
Python
12 lines
313 B
Python
import concurrent.futures
|
|
|
|
_pool = concurrent.futures.ThreadPoolExecutor(max_workers=10)
|
|
|
|
def add_to_queu(func: callable, args: tuple):
|
|
global _pool
|
|
_pool.submit(func, *args)
|
|
|
|
def wait_pool():
|
|
global _pool
|
|
_pool.shutdown(wait=True)
|
|
_pool = concurrent.futures.ThreadPoolExecutor(max_workers=10) |