I would also add a small sleep to the worker thread's event loop, so that it doesn't gobble all the cpu power and gives the main thread a chance to perform normally.

Qt Code:
  1. void myClassThread::run()
  2. {
  3. while(!bFinish)
  4. {
  5. //Do some work
  6. msleep(10);
  7. }
  8. //It will exit "while" when "bFinish" is true, so then the "run" method will exit and so the thread will stop
  9. }
To copy to clipboard, switch view to plain text mode