/* ELEC 377, Lab 3 * * common.c contains routines to be used from both the producer, and the consumer * Mutual Exclusion routines will be here */ #include #include #include #include #include #include #include "common.h" #define FALSE 0 #define TRUE 1 static struct shared *sharedptr; void mutexInit(struct shared *memptr){ // initialize the only mutex once, from the producer... sharedptr = memptr; } void getMutex(short pid){ // this should not return until it has mutual exclusion. Note that many versions of // this will probobly be running at the same time. } void releaseMutex(short pid){ // set the mutex back to initial state so that somebody else can claim it }