diff options
author | Alan Coopersmith <Alan.Coopersmith@sun.com> | 2005-07-16 20:52:25 +0000 |
---|---|---|
committer | Alan Coopersmith <Alan.Coopersmith@sun.com> | 2005-07-16 20:52:25 +0000 |
commit | ead37b08699f665a856c7ba29578c27c27db4100 (patch) | |
tree | 6470cbacdc7ba899039e68093f2746aba13b3a5c | |
parent | bbb49449cbc0815fd9c4faf9b6ee32be99a8aa3d (diff) |
Mark variables modified in signal handlers as volatile (part of Sun bug id
-rw-r--r-- | dix/dispatch.c | 10 | ||||
-rw-r--r-- | include/opaque.h | 4 |
2 files changed, 10 insertions, 4 deletions
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 |