C Implementation of the producer consumer problem using semaphore