本文整理汇总了Python中process.Process.wait方法的典型用法代码示例。如果您正苦于以下问题:Python Process.wait方法的具体用法?Python Process.wait怎么用?Python Process.wait使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类process.Process
的用法示例。
在下文中一共展示了Process.wait方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import wait [as 别名]
def __call__(self):
self.send(self.pong, PING, "hello world")
self.send(self.pong, FINISHED)
class PickledPong(PickledProcess):
def __init__(self):
Process.__init__(self)
def handlePING(self):
print self.body()
return True
def handleFINISHED(self):
return False
def __call__(self):
while {
PING: lambda: self.handlePING(),
FINISHED: lambda: self.handleFINISHED()
}[self.receive()]():
self.send(self._from(), PONG);
if __name__ == "__main__":
pong = Process.spawn(PickledPong())
ping = Process.spawn(PickledPing(pong))
Process.wait(ping)
Process.wait(pong)