'Waits for the thread to exit.
Allows abortion of task queue with ctrl-c'

def wait(self):

    if (sys.version_info >= (3, 4)):
        self._thread.join()
        return
    try:
        while self._thread.is_alive():
            time.sleep(0.5)
    except KeyboardInterrupt:
        log.error(u'Got    ctrl-c,    shutting    down    after    running    task    (if    any)    completes')
        self.shutdown(finish_queue=False)
        while self._thread.is_alive():
            time.sleep(0.5)
