threadpool 6

 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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章