debug aware. use quit() instead of terminate()
using pthread instead of QThread.