当前位置: 首页>>代码示例>>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;未经允许,请勿转载。