After we made this change, the programs now suffer from a new issue that isn't noticed immediately called a race condition.
A race condition happens when two programs try modifying the same variable simultaneously, which could lead to uncertainty in which value the variable will contain (either the value that the 1st program assigned, the value that the 2nd program assigned, or some other value.)
Specifically to our programs, a race condition will occur with the change of the counter variable, at the statements: counter++; of the Producer program and counter--; of the Consumer program.
Example: If counter is currently 5, and both programs execute these two statements at the very same time, we can't predict what counter will contain. It will either contain 4, 5, or 6 after the statements are executed.