use volatile instead of mutex