Killing all threads when closing program
Unsolved
General and Desktop
-
@michalt38
hi, closing a program implicates the termination of all threads. Am I right in assuming, you want to stop all threads when the UI is closed?You can do a Signal/Slot connect when you create the thread to a complish that:
QObject::connect(qApp, &QCoreApplication::aboutToQuit, myThread, &QThread::quit);
or if your QThread is a class member you can handle that in the destructor:
myClass::~myClass(){ myThread->quit(); myThread->wait(); }