Detect if X is ready with the SIGUSR1 signal instead of retrying the connection
From Xserver man page:
"When the server starts, it checks to see if it has inherited SIGUSR1 as SIG_IGN instead of the usual SIG_DFL. In this case, the server sends a SIGUSR1 to its
parent process after it has set up the various connection schemes. Xdm uses this feature to recognize when connecting to the server is possible."