XQuartz: Cleaned up our sleeping before adding the launchd socket.

(cherry picked from commit ebfe49dfca)
(cherry picked from commit 2cf74a76d5)
This commit is contained in:
Jeremy Huddleston 2008-09-03 02:36:39 -07:00
parent 7c5ca85a9e
commit b3836e5bdd
2 changed files with 2 additions and 25 deletions

View File

@ -116,18 +116,6 @@ static inline void darwinEvents_lock(void) {
}
if(darwinEvents == NULL) {
pthread_cond_wait(&mieq_ready_cond, &mieq_lock);
/* We want to give xinit time to finish running xinitrc before we accept
* the launchd socket connection.
*
* Yes, we lock then immediately unlock because the lock does a cond_wait
* when darwinEvents == NULL
*
* TODO: Cleanup this race more elegantly.
*
* For some reason, xinitrc doesn't run until after this anyways... =/
* sleep(2);
*/
}
}

View File

@ -190,20 +190,9 @@ static void accept_fd_handoff(int connected_fd) {
* into it.
*/
#if 0
struct timeval start, now;
gettimeofday(&start, NULL);
gettimeofday(&now, NULL);
while((now.tv_sec - start.tv_sec) * 1000000 + (now.tv_usec - start.tv_usec) < 2000000) {
unsigned usec = 3000001 - ((now.tv_sec - start.tv_sec) * 1000000 + (now.tv_usec - start.tv_usec));
fprintf(stderr, "X11.app: Received new DISPLAY fd: %d ... sleeping to allow xinitrc to catchup (%u).\n", launchd_fd, usec);
usleep(usec);
gettimeofday(&now, NULL);
}
#else
unsigned remain = 3000000;
fprintf(stderr, "X11.app: Received new DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd);
sleep(3);
#endif
while((remain = usleep(remain)) > 0);
#endif
fprintf(stderr, "X11.app Handing off fd to server thread via DarwinListenOnOpenFD(%d)\n", launchd_fd);