Domanda di colloquio di Optiver

One question about using semaphone to achieve threads synchronization.