當前位置: 首頁>>代碼示例>>Python>>正文


Python os.wait3方法代碼示例

本文整理匯總了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) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:18,代碼來源:test_wait3.py

示例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) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:14,代碼來源:test_wait3.py

示例3: test_wait3

# 需要導入模塊: import os [as 別名]
# 或者: from os import wait3 [as 別名]
def test_wait3(self):
        self._test_wait_multiple(lambda: os.wait3(0)) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:4,代碼來源:eintr_tester.py

示例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) 
開發者ID:IronLanguages,項目名稱:ironpython3,代碼行數:17,代碼來源:test_wait3.py


注:本文中的os.wait3方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。