Two threads waiting for a critical section