Mark variables modified in signal handlers as volatile (part of Sun bug id

4496504)
This commit is contained in:
Alan Coopersmith 2005-07-16 20:52:25 +00:00
parent bbb49449cb
commit ead37b0869
2 changed files with 10 additions and 4 deletions

View File

@ -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.

View File

@ -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