Elbit Systems interview question

How can I synchronize one thread to start only after another thread has finished?

Interview Answer

Anonymous

15 Sept 2025

I synchronized the threads using a semaphore so the second thread started only after the first had finished. I initialized the semaphore with zero permits, which caused the second thread to wait until the first thread released a permit after completing its work.