Hi, this problem might sound weird, but it got me crazy as I just started using QThread. Here is a short program to test using QThread.

Qt Code:
  1. #include <QThread>
  2. #include <QCoreApplication>
  3. #include <QDebug>
  4.  
  5. int main (int argc, char** argv) {
  6. QCoreApplication app(argc, argv);
  7. t.start();
  8. if (t.isRunning())
  9. qDebug() << "thread is started";
  10. //t.exit();
  11. //t.quit();
  12. t.terminate();
  13. qDebug() << "try to stop thread";
  14. if(!t.isRunning())
  15. qDebug() << "thread is stopped";
  16. return app.exec();
  17. }
To copy to clipboard, switch view to plain text mode 

I tried exit(), quit() and terminate() and waited for a long time.
The expected "thread is stopped" never ever shows up (no matter how long I waited). The thread is like running forever. Could anyone help me with this and show me how to properly stop a QThread?

Thank you.

Ves