mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-28 21:33:09 +00:00
XQuartz: mieq: Wait for the server to finish initializing before letting other threads mieqEnqueue
Avoid possible race condition whereby one thread might call mieqEnqueue before InitAndStartDevices finishes (cherry picked from commit 94e417ac87a98cd5c6bf2d7c495d702748398931)
This commit is contained in:
parent
b339052340
commit
ca46c01869
2 changed files with 35 additions and 13 deletions
14
dix/main.c
14
dix/main.c
|
|
@ -233,6 +233,12 @@ static int indexForScanlinePad[ 65 ] = {
|
|||
#endif
|
||||
|
||||
#ifdef XQUARTZ
|
||||
#include <pthread.h>
|
||||
|
||||
BOOL serverInitComplete = FALSE;
|
||||
pthread_mutex_t serverInitCompleteMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_cond_t serverInitCompleteCond = PTHREAD_COND_INITIALIZER;
|
||||
|
||||
int dix_main(int argc, char *argv[], char *envp[])
|
||||
#else
|
||||
int main(int argc, char *argv[], char *envp[])
|
||||
|
|
@ -377,6 +383,14 @@ int main(int argc, char *argv[], char *envp[])
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef XQUARTZ
|
||||
/* Let the other threads know the server is done with its init */
|
||||
pthread_mutex_lock(&serverInitCompleteMutex);
|
||||
serverInitComplete = TRUE;
|
||||
pthread_cond_broadcast(&serverInitCompleteCond);
|
||||
pthread_mutex_unlock(&serverInitCompleteMutex);
|
||||
#endif
|
||||
|
||||
NotifyParentProcess();
|
||||
|
||||
Dispatch();
|
||||
|
|
|
|||
Loading…
Reference in a new issue