Use a local variable to prevent races