homework4 6.11 The Sleeping-Barber Problem Version 0 |
|
👤 Author: by x20056 2016-11-08 18:25:29 |
#include
using namespace std;
/**
Requirement:
1. If there are no customers to be served, the barber goes to sleep
2. If a customer enter the barbershop and all chairs are occupied, then leave.
3. If the barber is busy but the chairs are available, then the customer sits in one of the free chairs.
4. If the barber is asleep, the customer wakes up the barber.
**/
enum{
BUSY,
ASLEEP,
AVAILABLE
};
//chair: to identify whether waiting chair is available
//b
Please login to reply. Login