Added notify to stop thread waiting in lock.