Python threading.TIMEOUT_MAX Examples

The following are 4 code examples for showing how to use threading.TIMEOUT_MAX(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module threading , or try the search function .

Example 1
Project: deepWordBug   Author: QData   File: s3.py    License: Apache License 2.0 6 votes vote down vote up
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 
Example 2
Project: aws-elastic-beanstalk-cli   Author: aws   File: s3.py    License: Apache License 2.0 6 votes vote down vote up
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 
Example 3
Project: imapfw   Author: OfflineIMAP   File: imaplib2.py    License: MIT License 5 votes vote down vote up
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 
Example 4
Project: openhtf   Author: google   File: test_executor.py    License: Apache License 2.0 5 votes vote down vote up
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)