def __init__(self, worker_func, task_count, worker_count=-1):
# initialize completion task worker pool
# if number of workers is not specified, set it to the number of CPUs
if worker_count == -1:
worker_count = cpu_count()
self.worker_pool = pool.Pool(size=worker_count)
self.worker_pool_closed = False
# store requested task count and callback function
self.task_count = task_count
self.worker_func = worker_func
评论列表
文章目录