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


Python threading.TIMEOUT_MAX屬性代碼示例

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


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

示例1: _wait_for_threads

# 需要導入模塊: import threading [as 別名]
# 或者: from threading import TIMEOUT_MAX [as 別名]
def _wait_for_threads(jobs):
    alive = True
    while alive:
        alive = False
        for j in jobs:
            # We want to wait forever for the thread to finish.
            # j.join() however is a blocking call. We need to pass in a
            # time to j.join() so it is non blocking. This way a user can use
            # CTRL+C to terminate the command. 2**31 is the largest number we
            # can pass into j.join()
            if sys.version_info > (3, 0):
                timeout = threading.TIMEOUT_MAX
                j.join(timeout)
                if j.is_alive():
                    alive = True
            else:
                timeout = 2**16
                j.join(timeout)
                if j.isAlive():
                    alive = True 
開發者ID:QData,項目名稱:deepWordBug,代碼行數:22,代碼來源:s3.py

示例2: get_response

# 需要導入模塊: import threading [as 別名]
# 或者: from threading import TIMEOUT_MAX [as 別名]
def get_response(self, exc_fmt=None):
        self.callback = None
        if __debug__: self.parent._log(3, '%s:%s.ready.wait' % (self.name, self.tag))
        self.ready.wait(threading.TIMEOUT_MAX)

        if self.aborted is not None:
            typ, val = self.aborted
            if exc_fmt is None:
                exc_fmt = '%s - %%s' % typ
            raise typ(exc_fmt % str(val))

        return self.response 
開發者ID:OfflineIMAP,項目名稱:imapfw,代碼行數:14,代碼來源:imaplib2.py

示例3: wait

# 需要導入模塊: import threading [as 別名]
# 或者: from threading import TIMEOUT_MAX [as 別名]
def wait(self):
    """Waits until death."""
    # Must use a timeout here in case this is called from the main thread.
    # Otherwise, the SIGINT abort logic in test_descriptor will not get called.
    timeout = 31557600  # Seconds in a year.
    if sys.version_info >= (3, 2):
      # TIMEOUT_MAX can be too large and cause overflows on 32-bit OSes, so take
      # whichever timeout is shorter.
      timeout = min(threading.TIMEOUT_MAX, timeout)
    self.join(timeout) 
開發者ID:google,項目名稱:openhtf,代碼行數:12,代碼來源:test_executor.py


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