'Create a TestThreadController.
:param fn: A test function which takes a TestThreadController as its
only argument'

def __init__(self, fn):

    self.wait_lock = threading.Condition()
    self.wait_at = None
    self.waiting = False
    self.epoch = 1
    self.last_epoch = 0
    self.start_event = eventlet.event.Event()
    self.running = False
    self.complete = False
    def deferred_start():
        self.start_event.wait()
        fn()
        with self.wait_lock:
            self.complete = True
            self.wait_lock.notify_all()
    self.thread = eventlet.greenthread.spawn(deferred_start)
    self.all_threads[self.thread] = self
