For a homework assignment i need to program the following scenario. This is going to be done using semaphores using BACI (which is C--)
There are 2 unisex restrooms
Here is what I have. This allows 1 person in the restroom at a time without deadlock or starvation. I'm in need of assistance with how to make it so 4 people can be in the restroom at a time.
const int Delayx = 60;
int i;
semaphore max_capacity;
semaphore woman;
semaphore man;
semaphore mutex;
void Delay(void)
{
int DelayTime;
DelayTime = random(Delayx);
for (i = 0; i