class ThreadPool:
def __init__(self, threadnum = 5,
target=None, *args, **kwargs):
threadnum = threadnum if threadnum > 0 else 1
self.__lock = threading.Lock()
self.__condition = threading.Condition(self.__lock)
self.__target = target
self.__args = args
self.__kwargs = kwargs
self.__threadList = []
self.__freeThread = threadnum
self.__maxThread = threadnum
for i in range(0, 5):
thrd = PoolThread(self.__notify_free_thread, target, *args, **kwargs)
print thrd.getName()
self.__threadList.append(thrd)
pass
threadpool 6
最新推荐文章于 2024-06-05 17:26:25 发布