semaphore synchronization example in c - Search