threadpool 8

来源:互联网 发布:伊宁企业网站怎么优化 编辑:程序博客网 时间:2024/04/27 19:22

     def start_thread(self, wait=True, target=None, *args, **kwargs):
        print 'start_thread'
#        thrd = PoolThread()
        rtn = False
        with self.__condition:
            if (self.__freeThread <= 0):
                if wait:
                        self.__condition.wait()
                else:
                    return False
        for thrd in self.__threadList:
            if thrd.is_running():
                continue
            if target:
                thrd.reset_target(target, *args, **kwargs)
            thrd.start(False)
            rtn = True
            break
        print 'start_thread end'
        return rtn

原创粉丝点击