def _execute(self, results: TestResultSet) -> Generator[(events.ExecutionEvent, None, None)]:
    'All events come from a queue where different workers push their events.'
    tasks_queue = self._get_tasks_queue()
    events_queue: Queue = Queue()
    workers = self._init_workers(tasks_queue, events_queue, results)

    def stop_workers() -> None:
        for worker in workers:
            ident = cast(int, worker.ident)
            stop_worker(ident)
            worker.join()
    is_finished = False
    try:
        while (not is_finished):
            time.sleep(0.001)
            is_finished = all(((not worker.is_alive()) for worker in workers))
            while (not events_queue.empty()):
                event = events_queue.get()
                (yield event)
                if isinstance(event, events.Interrupted):
                    raise ThreadInterrupted
    except ThreadInterrupted:
        stop_workers()
    except KeyboardInterrupt:
        stop_workers()
        (yield events.Interrupted(results=results, schema=self.schema))
All events come from a queue where different workers push their events.
def _execute(self, results: TestResultSet) -> Generator[(events.ExecutionEvent, None, None)]:
    
    tasks_queue = self._get_tasks_queue()
    events_queue: Queue = Queue()
    workers = self._init_workers(tasks_queue, events_queue, results)

    def stop_workers() -> None:
        for worker in workers:
            ident = cast(int, worker.ident)
            stop_worker(ident)
            worker.join()
    is_finished = False
    try:
        while (not is_finished):
            time.sleep(0.001)
            is_finished = all(((not worker.is_alive()) for worker in workers))
            while (not events_queue.empty()):
                event = events_queue.get()
                (yield event)
                if isinstance(event, events.Interrupted):
                    raise ThreadInterrupted
    except ThreadInterrupted:
        stop_workers()
    except KeyboardInterrupt:
        stop_workers()
        (yield events.Interrupted(results=results, schema=self.schema))