Fix setting None update workers not causing all threads to stop

This commit is contained in:
Lonami Exo 2017-09-30 18:44:37 +02:00
parent 8c3c990e74
commit f1bca0fd06

View File

@ -79,11 +79,14 @@ class UpdateState:
"""Raises "StopIterationException" on the worker threads to stop them, """Raises "StopIterationException" on the worker threads to stop them,
and also clears all of them off the list and also clears all of them off the list
""" """
with self._updates_lock: if self._workers:
# Insert at the beginning so the very next poll causes an error with self._updates_lock:
# TODO Should this reset the pts and such? # Insert at the beginning so the very next poll causes an error
self._updates.appendleft(StopIteration()) # on all the worker threads
self._updates_available.set() # TODO Should this reset the pts and such?
for _ in range(self._workers):
self._updates.appendleft(StopIteration())
self._updates_available.set()
for t in self._worker_threads: for t in self._worker_threads:
t.join() t.join()