Use an extra bool variable to indicate thread validity