In my main I have two threads running the following function:
int i = 0;
void foo()
{
++i;
printf("%d", i);
}
I ran it 10000 times and I had 3 different results: {1 2}, {1 1}, {2 1}
First two I understand. The question is how the result can be {2 1} and why {2 2} doesn't appear at all.
Thank you!