I found out my semaphores were not in shared memory, hence the semaphores not working properly. I did:
mem_mutexCheckout1Count = (sem_t*) mmap(NULL, sizeof(mem_mutexCheckout1Count), PROT_READ | PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
To all my mutex's to fix.