Declare shared thread variable as volatile