本文整理汇总了Python中gofer.common.Thread.current方法的典型用法代码示例。如果您正苦于以下问题:Python Thread.current方法的具体用法?Python Thread.current怎么用?Python Thread.current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gofer.common.Thread
的用法示例。
在下文中一共展示了Thread.current方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shutdown
# 需要导入模块: from gofer.common import Thread [as 别名]
# 或者: from gofer.common.Thread import current [as 别名]
def shutdown(self, hard=False):
"""
Shutdown the pool.
Drain the queue, terminate and join all workers.
:param hard: Abort threads in the pool.
When not aborted, work in progress will attempt to
be completed before shutdown.
:type hard: bool
:return: List of orphaned calls. List of: Call.
:rtype: list
"""
drained = self.drain()
if hard:
for t in self.threads:
t.abort()
self.queue.put(Worker.HALT)
for t in self.threads:
if t == Thread.current():
continue
t.join()
return drained