The cofinality of a partially ordered set