How would a flag avoid the race condition?