// This function will be called by the cup boy when he wishes to get a dirty cup to clean. Cup* wash_dirty(){ return BB_pop(DBB); }
// This function is called by a student after he places an order for a drink, // while he waits for his order to be made. // If there is a drink ready in the buffer, he will take it (denoted by the cup the drink was made in). // If not, he will wait until a drink becomes available Cup* get_drink(){ return BB_pop(DrinkBB); }
// This function is called by a bartender whenever he wishes to make a drink and needs a clean cup for it. // If there are no clean cups left, the bartender should wait until the cup boy returns with clean cups. Cup* get_clean_cup(){ return BB_pop(CBB); }
// This function is called by a bartender whenever one is free to deal with students’ actions. // The Action located at the beginning of the buffer is returned and removed. // If there are no actions, the bartender will wait until more actions arrive. Action* get_action(){ return BB_pop(ABB); }
struct Cup* get_drink() { struct Cup* c=(struct Cup*) BB_pop(drinkBB); return c; }
struct Action* get_action(void) { struct Action* ac=(struct Action*) BB_pop(bb); printf(1, "\ngot action\n"); return ac; }
struct Cup* wash_dirty() { struct Cup* c=(struct Cup*) BB_pop(dbb); dc_count--; return c; }
struct Cup* get_clean_cup() { struct Cup* c=(struct Cup*) BB_pop(cbb); return c; }