本文整理汇总了Python中multiprocessing.Manager.finished方法的典型用法代码示例。如果您正苦于以下问题:Python Manager.finished方法的具体用法?Python Manager.finished怎么用?Python Manager.finished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.Manager
的用法示例。
在下文中一共展示了Manager.finished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from multiprocessing import Manager [as 别名]
# 或者: from multiprocessing.Manager import finished [as 别名]
'''Signal the run() to shutdown before joining'''
self.alive.clear()
super(MD5Cracker, self).join(timeout)
# Graceful clean up
def cleanup():
for worker in workers:
worker.join()
atexit.register(cleanup)
# init vars
workers = []
work_queue = Manager().Queue()
global_namespace = Manager().Namespace()
global_namespace.finished = False
global_namespace.count = 0
# Set up Processes
number_of_processes = 16
for i in range(number_of_processes):
worker = MD5Cracker(work_queue, global_namespace)
worker.start()
workers.append(worker)
print "Target Hash: {}".format(hash)
maxChars = 13
while_count = 1
for baseWidth in range(1, maxChars + 1):