main.c now only uses one semaphore