PDA

View Full Version : What is safest way of force terminating a QThread without QThread::terminate()



ayanda83
15th August 2017, 14:58
Hi guys, what is the safest way of force terminating a thread without using the function QThread::terminate(). The documentation says this functions is dangerous and should be avoided, so what is the work around this, if I want to force terminate the thread while its still running some operation?

high_flyer
15th August 2017, 21:42
One way would be to add a flag to your thread that it monitors, once the flag is set, you can have your thread terminate gracefully, cleaning up after it self.