#include #include #include "producer.h" #include "shared.h" // Producer main function // TODO: Add waiting for one producer at a time // Add ability to use shared memory void* Producer(void* arg) { long int insertNum; SharedStruct* sharedMem; while (1) { insertNum = produce_item(); printf("The random number is %li\n", insertNum); // sem_wait(&semProducer); // down(&empty); // down(&mutex); insert_item(insertNum); // sem_post(&semProducer); // up(&mutex); // up(&full); break; } } // Generate a number between 0 and 9 long int produce_item(void) { return random() % 10; } // Insert a number into the shared memory void insert_item(long int item) { ; }