本文整理汇总了Python中os.wait3方法的典型用法代码示例。如果您正苦于以下问题:Python os.wait3方法的具体用法?Python os.wait3怎么用?Python os.wait3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类os
的用法示例。
在下文中一共展示了os.wait3方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: wait_impl
# 需要导入模块: import os [as 别名]
# 或者: from os import wait3 [as 别名]
def wait_impl(self, cpid):
# This many iterations can be required, since some previously run
# tests (e.g. test_ctypes) could have spawned a lot of children
# very quickly.
deadline = time.monotonic() + 10.0
while time.monotonic() <= deadline:
# wait3() shouldn't hang, but some of the buildbots seem to hang
# in the forking tests. This is an attempt to fix the problem.
spid, status, rusage = os.wait3(os.WNOHANG)
if spid == cpid:
break
time.sleep(0.1)
self.assertEqual(spid, cpid)
self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
self.assertTrue(rusage)
示例2: wait_impl
# 需要导入模块: import os [as 别名]
# 或者: from os import wait3 [as 别名]
def wait_impl(self, cpid):
for i in range(10):
# wait3() shouldn't hang, but some of the buildbots seem to hang
# in the forking tests. This is an attempt to fix the problem.
spid, status, rusage = os.wait3(os.WNOHANG)
if spid == cpid:
break
time.sleep(1.0)
self.assertEqual(spid, cpid)
self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
self.assertTrue(rusage)
示例3: test_wait3
# 需要导入模块: import os [as 别名]
# 或者: from os import wait3 [as 别名]
def test_wait3(self):
self._test_wait_multiple(lambda: os.wait3(0))
示例4: wait_impl
# 需要导入模块: import os [as 别名]
# 或者: from os import wait3 [as 别名]
def wait_impl(self, cpid):
# This many iterations can be required, since some previously run
# tests (e.g. test_ctypes) could have spawned a lot of children
# very quickly.
for i in range(30):
# wait3() shouldn't hang, but some of the buildbots seem to hang
# in the forking tests. This is an attempt to fix the problem.
spid, status, rusage = os.wait3(os.WNOHANG)
if spid == cpid:
break
time.sleep(0.1)
self.assertEqual(spid, cpid)
self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
self.assertTrue(rusage)