0

When I execute my thread in Qt with start() I can check if it is running with QThread::isRunning (). It returns true in case the thread is still running. After calling quit() i can quit my thread.

Now my question:

After calling quit(), my isRunning () query should return false, am I right? Equally QThread::isFinished () should return false.

With this question I just want to confirm that i understood one of the main principles of QThread.

nookieTUI
  • 47
  • 1
  • 4
  • Replace "after" with "at some point in the future", that's all guarantee threads give you. – Frank Osterfeld Mar 19 '13 at 20:36
  • For a really good explanation of thread lifecycle, try this: http://stackoverflow.com/questions/17045368/qthread-emits-finished-signal-but-isrunning-returns-true-and-isfinished-re – Mr. Developerdude Nov 01 '14 at 21:21

1 Answers1

0

I can be wrong, but documentation tells us that quit and exit(int ) finishes thread event loop. But exiting thread event loop doesn't mean that thread is finished. You can even run another qthread without even starting event loop by subclassing and reimplementing run method. So calling quit method doesn't mean that thread isFinished() return true. Just connect yourself to finished() signal and do what you wanted with finished thread.

JustAnotherCurious
  • 2,208
  • 15
  • 32