You've "invented" interlocking railway semaphores, after which the computer science concept was named.

https://en.wikipedia.org/wiki/Railway_semaphore_signal

https://en.wikipedia.org/wiki/Interlocking