本文整理汇总了Python中ThreadPool.ThreadPool.getFinishCount方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadPool.getFinishCount方法的具体用法?Python ThreadPool.getFinishCount怎么用?Python ThreadPool.getFinishCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadPool.ThreadPool
的用法示例。
在下文中一共展示了ThreadPool.getFinishCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handler
# 需要导入模块: from ThreadPool import ThreadPool [as 别名]
# 或者: from ThreadPool.ThreadPool import getFinishCount [as 别名]
def handler( ips_cmds ):
taskCount = len( ips_cmds )
if taskCount > _THREAD_NUMBER:
threadCount = _THREAD_NUMBER
else:
threadCount = taskCount
pool=ThreadPool(threadCount)
for ip, cmds in ips_cmds:
pool.addTask(telnetTask, ip = ip, cmds = cmds )
pool.start()
dlg = wx.ProgressDialog("Waitng", "Waiting",
maximum = taskCount,
parent= None,
#style = wx.PD_CAN_ABORT|wx.PD_APP_MODAL
)
while pool.getFinishCount() < taskCount:
dlg.Update(pool.getFinishCount(), "%d of %d" %(pool.getFinishCount(), taskCount))
wx.MilliSleep(100)
dlg.Destroy()
result = pool.show()
pool.join()#pool itself is also a thread
return result