feat(utils/thread_checker): util class to check the thread leakage for closeEvent in qt
Description
Simple thread checker utility class which could be use for troubleshooting thread leakage for example in qt .closeEvent
like this:
def closeEvent(self, event):
self.bec_dispatcher.disconnect_all()
if not hasattr(self, "thread_tracker"):
self.thread_tracker = ThreadTracker(exclude_names=["loguru"])
try:
self.thread_tracker.check_unfinished_threads()
print("Active threads at application close:")
list_active_threads()
except Exception as e:
print(e)
finally:
event.accept()
Related Issues
None
Type of Change
- New util class thread_checker
Potential side effects
None, it is not use in any production code.