As we notice Dispatch() uses a triple 'while' loop. The first should run infinitely for the life of the X Server and breaks out only in special conditions when a 'dispatchException' is raised. Such a condition would be the receipt of a SIGTERM or a SIGINT singal from the X Server. In this case GiveUp() handles those signals and sets dispatchException to DE_TERMINATE and also isItTimeToYield (see next paragraphs) to TRUE.

Twice in the Dispatch the ProcessInputEvents() and FlushIfCriticalOutputPending() pair are called. Once before waiting for ready clients and once before handling requests from a specific client. Those routines are explained in section 3.2.5.1.

nready = WaitForSomething(clientReady);

WaitForSomething() returns at nready the count of the client indexes and also fills pClientsReady with the ready client's indexes. It is explained in section 3.2.5.2.