before thread changes