I have this design. I could not achieve what I need:
- B is inherited from A.
- A is inherited from QThread.
My goal is restart(re-run) to "worker" thread when it has finished its task. I intend to call the worker thread destructor for this approach because, it takes memory from heap. I need to clean-up all the related variables.
How can I achieve this?
int main()
{
// re-start start
A* worker = B::getInstance();
worker->start();
// re-start end
return a.exec();
}
Writing a for-loop is not a solution. Because, I need to learn worker thread is stopped completely. I tried using worker->wait(). But it does not work.