示例#1
0
/** Winnifred puts slices on the buffet, gradually. */
void *winnifred( void *arg ) {
  sleep( 1 );
  addPizza( 1, "cheese" );
  addPizza( 1, "meat" );

  sleep( 3 );
  addPizza( 1, "veggie" );

  sleep( 1 );
  addPizza( 1, "works" );

  return NULL;
}
示例#2
0
std::vector<const Pizza::Pizza*>*	Waiter::checkCommand(const std::string& command)
{
  size_t				start = 0;
  size_t				end;
  size_t				count = 0;
  std::vector<const Pizza::Pizza*>	*pizzaList = new std::vector<const Pizza::Pizza*>;
  const Pizza::Pizza*			pizza;

  while ((end = command.find(';', start)) != std::string::npos)
    {
      pizza = getPizza(command.substr(start, (end - 1) - start));
      count = getNumberOfPizza(command.substr(start, (end - 1) - start));
      while (pizza && count--)
	pizzaList->push_back(addPizza(pizza));
      start = end + 1;
    }
  pizza = getPizza(command.substr(start, std::string::npos));
  count = getNumberOfPizza(command.substr(start, std::string::npos));
  while (pizza && count--)
      pizzaList->push_back(addPizza(pizza));
  return (pizzaList);
}