Mutual exclusion between the two threads