'implementation of Queue.join which takes a \'timeout\' argument
returns true on success, false on timeout'

def _timed_queue_join(self, timeout):

    deadline = (time() + timeout)
    queue = self._queue
    queue.all_tasks_done.acquire()
    try:
        while queue.unfinished_tasks:
            delay = (deadline - time())
            if (delay <= 0):
                return False
            queue.all_tasks_done.wait(timeout=delay)
        return True
    finally:
        queue.all_tasks_done.release()
