Hi,

Suppuse I have the following function

static int staticIntX = 2;

int inc()
{
staticIntX++;
return staticIntX;
}

What are the possible outputs for this function if 2 different threads are calling it?

I understand that there are 3 possible answers:
2,2
2,3
3,3

the thing is that I do not undertand how the 2,2 result can happen.
Can anyone explain?

Thanks
Avi