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


Python signal.ItimerError方法代碼示例

本文整理匯總了Python中signal.ItimerError方法的典型用法代碼示例。如果您正苦於以下問題:Python signal.ItimerError方法的具體用法?Python signal.ItimerError怎麽用?Python signal.ItimerError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在signal的用法示例。


在下文中一共展示了signal.ItimerError方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sig_vtalrm

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import ItimerError [as 別名]
def sig_vtalrm(self, *args):
        self.hndl_called = True

        if self.hndl_count > 3:
            # it shouldn't be here, because it should have been disabled.
            raise signal.ItimerError("setitimer didn't disable ITIMER_VIRTUAL "
                "timer.")
        elif self.hndl_count == 3:
            # disable ITIMER_VIRTUAL, this function shouldn't be called anymore
            signal.setitimer(signal.ITIMER_VIRTUAL, 0)
            if test_support.verbose:
                print("last SIGVTALRM handler call")

        self.hndl_count += 1

        if test_support.verbose:
            print("SIGVTALRM handler invoked", args) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:19,代碼來源:test_signal.py

示例2: test_itimer_exc

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import ItimerError [as 別名]
def test_itimer_exc(self):
        # XXX I'm assuming -1 is an invalid itimer, but maybe some platform
        # defines it ?
        self.assertRaises(signal.ItimerError, signal.setitimer, -1, 0)
        # Negative times are treated as zero on some platforms.
        if 0:
            self.assertRaises(signal.ItimerError,
                              signal.setitimer, signal.ITIMER_REAL, -1) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:10,代碼來源:test_signal.py

示例3: sig_vtalrm

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import ItimerError [as 別名]
def sig_vtalrm(self, *args):
        self.hndl_called = True

        if self.hndl_count > 3:
            # it shouldn't be here, because it should have been disabled.
            raise signal.ItimerError("setitimer didn't disable ITIMER_VIRTUAL "
                "timer.")
        elif self.hndl_count == 3:
            # disable ITIMER_VIRTUAL, this function shouldn't be called anymore
            signal.setitimer(signal.ITIMER_VIRTUAL, 0)

        self.hndl_count += 1 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:14,代碼來源:test_signal.py


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