add thread interrupted check