|
|
|
|
|
|
|
|
class ProductionQueue { // Production Queue Class
|
|
|
class ProductionQueue { // Production Queue Class
|
|
|
private:
|
|
|
private:
|
|
|
Mutex myMutex; // Contains a mutex and
|
|
|
Mutex myMutex; // Contains a mutex and
|
|
|
volatile int LatestSize; // a volatile (blinking light) size
|
|
|
|
|
|
|
|
|
volatile unsigned int LatestSize; // a volatile (blinking light) size
|
|
|
ProductionGateway myGateway; // integrated with a production
|
|
|
ProductionGateway myGateway; // integrated with a production
|
|
|
queue<T> myQueue; // gateway and a queue.
|
|
|
queue<T> myQueue; // gateway and a queue.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
myGateway.produce(); // indicator and tell the gateway.
|
|
|
myGateway.produce(); // indicator and tell the gateway.
|
|
|
} // When we're done it can be grabbed.
|
|
|
} // When we're done it can be grabbed.
|
|
|
|
|
|
|
|
|
int size() { // To check the size we look at
|
|
|
|
|
|
|
|
|
unsigned int size() { // To check the size we look at
|
|
|
return LatestSize; // the blinking light.
|
|
|
return LatestSize; // the blinking light.
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
};
|