No, it does not solve the critical section problem. When p0 leaves its critical section, it sets turn = 0. Then, when thread p1 wants to enter its critical section, it must wait because turn is not 1. p1 will never be able to enter its critical section.