Long story short: when I call exit() from a process started from QtConcurrent::run() it enters an infinite loop here:
Qt Code:
  1. 0 pthread_cond_wait pthread_cond_wait.S 162 0x00007ffff609459c
  2. 1 wait qwaitcondition_unix.cpp 87 0x00007ffff6a27a7b
  3. 2 QWaitCondition::wait qwaitcondition_unix.cpp 159 0x00007ffff6a27a7b
  4. 3 QThreadPoolPrivate::waitForDone qthreadpool.cpp 295 0x00007ffff6a1c808
  5. 4 QThreadPool::~QThreadPool qthreadpool.cpp 428 0x00007ffff6a1cfff
  6. 5 QGlobalStaticDeleter<QThreadPool>::~QGlobalStaticDeleter qglobal.h 1796 0x00007ffff6a1d695
  7. 6 __run_exit_handlers exit.c 78 0x00007ffff55ad045
  8. 7 exit exit.c 100 0x00007ffff55ad095
  9. 8 fsElement::fsElement fselement.cpp 41 0x000000000040b266
  10. 9 fsElement::populateDirList fselement.cpp 65 0x000000000040b70b
  11. 10 fsElement::findFilesAndDirs fselement.cpp 120 0x000000000040be77
  12. 11 fsElement::findFilesAndDirs fselement.cpp 122 0x000000000040be9c
  13. 12 fsElement::findFilesAndDirs fselement.cpp 122 0x000000000040be9c
  14. 13 fsElement::findFilesAndDirs fselement.cpp 122 0x000000000040be9c
  15. 14 fsElement::findFilesAndDirs fselement.cpp 122 0x000000000040be9c
  16. 15 fsElement::findFilesAndDirs fselement.cpp 122 0x000000000040be9c
  17. 16 fsElement::findFilesAndDirs fselement.cpp 122 0x000000000040be9c
  18. 17 fsElement::findFilesAndDirs fselement.cpp 122 0x000000000040be9c
  19. 18 fsElement::findFilesAndDirs fselement.cpp 122 0x000000000040be9c
  20. 19 QtConcurrent::VoidStoredMemberFunctionPointerCall0<void, fsElement>::runFunctor qtconcurrentstoredfunctioncall.h 216 0x000000000040adc4
  21. 20 QtConcurrent::RunFunctionTask<void>::run qtconcurrentrunbase.h 120 0x000000000040a396
  22. 21 QThreadPoolThread::run qthreadpool.cpp 106 0x00007ffff6a1ca4f
  23. 22 QThreadPrivate::start qthread_unix.cpp 248 0x00007ffff6a26a25
  24. 23 start_thread pthread_create.c 301 0x00007ffff608fc1a
  25. 24 clone clone.S 115 0x00007ffff5649a9d
To copy to clipboard, switch view to plain text mode 
So I guess I shouldn't use exit() in this fashion. Is there some other way to exit a thread in this situation?

Bonus, longer question: I just want a way to perform some heavy i/o work and still keep the GUI up to date and responsive (I'm writing a file searching app as an exercise). Doing it in a seperate thread worked quite well, but I'd also like to have the ability to pause and cancel the work. Is threading the best way to do it? What should I do to do it right? QThread? QRunnable? Or is QtConcurrent the best way?