本文整理汇总了Python中multiprocessing.Value.acquire方法的典型用法代码示例。如果您正苦于以下问题:Python Value.acquire方法的具体用法?Python Value.acquire怎么用?Python Value.acquire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.Value
的用法示例。
在下文中一共展示了Value.acquire方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: in
# 需要导入模块: from multiprocessing import Value [as 别名]
# 或者: from multiprocessing.Value import acquire [as 别名]
Successes.value += 1
Successes.release()
return 'S'
except KeyboardInterrupt:
return '-'
except superfastmatch.SuperFastMatchError, e:
Failures.acquire()
Failures.value += 1
Failures.release()
if e.status in (502, '502'):
warn("The SuperFastMatch server is down.")
else:
warn("Exception {2!r} caught while searching for {0} character string: {1!r}".format(len(searchtext), searchtext[:40] + '...', e))
return 'F'
except Exception, e:
Failures.acquire()
Failures.value += 1
Failures.release()
warn("Exception {2!r} caught while searching for {0} character string: {1!r}".format(len(searchtext), searchtext[:40] + '...', e))
return 'F'
except:
Failures.acquire()
Failures.value += 1
Failures.release()
warn("Untyped exception caught while searching for {0} character string: {1!r}".format(len(searchtext), searchtext[:40] + '...'))
return 'F'
def go(url, dirname, statuschar, workernum, modulo, textrange):
def info(msg):
print u"[{0}] {1}".format(workernum, msg)