Use volatile for member variables that are changed in a different thread