in the 2007 question,
while (wants2 == true);
it means, if wants2=true ====> P1 is in continuous loop
in the 2015 question,
while (varQ == true)
{
/* Critical Section */
varP = false;
}
VarQ=true ====> X entered in Critical Section.
wants1 = true;
while (wants2 == true);
/* Critical Section */
wants1 = false;
equivalent to
wants1 = true;
while (wants2 == true)
{
}
/* Critical Section */
wants1 = false;
BUT IT IS NOT EQUVIVALENT TO
wants1 = true;
while (wants2 == true)
{
/* Critical Section */
wants1 = false;
} ( this is GATE2015 Question )