def METHOD_NAME(self):
    # Close standard input, so we don't get SIGINT from ^C
    try:
        sys.stdin.close()
    except Exception as e:
        log.info("can't close stdin: {}".format(e))
    # (re)initialize random number generator in this process
    random.seed()
    while not self.shutdown_received:
        message, task_id, fn, args, kwargs = self.task_queue.get()[:5]
        if message == 'shutdown':
            break
        try:
            result = fn(*args, **kwargs)
        except BaseException as e:
            result_tuple = ('exception', task_id, (e, traceback.format_exc()))
        else:
            result_tuple = ('result', task_id, result)
        self.result_queue.put(result_tuple)
    log.debug('exiting task_loop')
    return