Make mutex test variables volatile to prevent potential errors cused by optimizer