From wikipedia:
Race conditions arise in software when separate computer processes or threads of execution depend on some shared state.
If I'm understanding this correctly, does this mean that the following is also a race condition eventhough shared resources are protected?
int x; // global
Thread1:
Lock(m);
x=1;
Unlock(m)
Thread2:
Lock(m);
x=2;
Unlock(m);
Clearly the output depends on the order of execution.