'Wait until there is a job and do it.'

def _do_next_job(self):

    with self._mutex:
        while True:
            job = self._jobs.peek()
            difference = (job.next_time - time.time())
            duration = min(difference, self.min_reaction_time)
            if (duration <= 0):
                break
            with released(self._mutex):
                time.sleep(duration)
        self._cleared = False
        job = self._jobs.get()
        with released(self._mutex):
            if job.func.thread:
                t = threading.Thread(target=self._call, args=(job.func,))
                t.start()
            else:
                self._call(job.func)
            job.next()
        if (not self._cleared):
            self._jobs.put(job)
