Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions qtapputils/managers/taskmanagers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# ---- Standard imports
from collections import OrderedDict
import uuid
from time import sleep

# ---- Third party imports
from qtpy.QtCore import QObject, QThread, Signal
Expand Down Expand Up @@ -203,11 +204,13 @@ def _run_pending_tasks(self):

# Even though the worker has executed all its tasks,
# we may still need to wait a little for it to stop properly.
try:
qtwait(lambda: not self._thread.isRunning(), timeout=10)
except TimeoutError:
print("Error: unable to stop {}'s working thread.".format(
self.__class__.__name__))
i = 0
while self._thread.isRunning():
sleep(0.1)
i += 1
if i > 100:
print("Error: unable to stop {}'s working thread.".format(
self.__class__.__name__))

self._running_tasks = self._pending_tasks.copy()
self._pending_tasks = []
Expand Down
Loading