Use of QSemaphore insteasd of voliatile bool.