I know how looks dekker algorithm but why something like that would not work?
static void Enter(int i)
{
int j = 1 - i;
flags[i] = true;
if(flags[j])
{
while (turn!=i)
{
}
}
}
static void Exit(int i)
{
flags[i] = false;
turn = 1 - i;
}
What is wrong with my solution?