diff --git a/dix/dispatch.c b/dix/dispatch.c index 0fed6a0e7..99103ae65 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -157,8 +157,14 @@ static int nextFreeClientID; /* always MIN free client ID */ static int nClients; /* number of authorized clients */ CallbackListPtr ClientStateCallback; -char dispatchException = 0; -char isItTimeToYield; + +/* dispatchException & isItTimeToYield must be declared volatile since they + * are modified by signal handlers - otherwise optimizer may assume it doesn't + * need to actually check value in memory when used and may miss changes from + * signal handlers. + */ +volatile char dispatchException = 0; +volatile char isItTimeToYield; /* Various of the DIX function interfaces were not designed to allow * the client->errorValue to be set on BadValue and other errors. diff --git a/include/opaque.h b/include/opaque.h index 8d7408f8a..277ca61ac 100644 --- a/include/opaque.h +++ b/include/opaque.h @@ -42,8 +42,8 @@ from The Open Group. extern char *defaultTextFont; extern char *defaultCursorFont; extern int MaxClients; -extern char isItTimeToYield; -extern char dispatchException; +extern volatile char isItTimeToYield; +extern volatile char dispatchException; /* bit values for dispatchException */ #define DE_RESET 1