A multi-thread program simulates a barbershop. The shop has 2 seats
and 2 barbers, so it is possible to serve up to 2 customers at the
same time. In addition, it has a waiting room with 5 seats, so that up
to 5 customers can sit down waiting for their turn.

Every barber is simulated by a thread with the following code:

void *barber(void *arg)
{
	int index = (int) arg;   // identifies the seat, can be 0 or 1
	while (1) {
		wait_for_customers(index);
		service_customer();
		free_seat(index);
	}
}

Functions wait_for_customer() blocks the thread until there is a
customer.  Function service_customer() does the job. Finally, function
free_seat() says to the customer that the service has been completed
and it can stand up and free the seat.

Every customer is simulated by the following thread code:

void *customer(void *arg)
{
	int k = (int) arg;
	int seat = wait_for_seat();
	if (seat == -1) // everything is full
		return;
	else wait_for_service(seat);
}

Function wait_for_seat() returns the first index of free seat. If
there are no free seats, but there is a place in the waiting roos, the
functions blocks the thread waiting for a free seat. If the waiting
room is full, the function returns -1.

Once seated, the customer waits for the barber to finish with the
wait_for_service().

Create the data structure to model the barbershop and implement
functions wait_for_customer(), free_seat(), wait_for_seat(), and
wait_for_service().

