A Solution to the Sleeping Barber Problem