add stop flag in worker thread