volatile: is NOT a frill, i

Michael Zehr tada at athena.mit.edu
Tue Apr 12 00:50:02 AEST 1988


In article <77200031 at uiucdcsp> gillies at uiucdcsp.cs.uiuc.edu writes:
>
>Can you honestly predict what these shared-memory multiprocessing guys
>really need? 

If i understand what is meant by volatile, then there are uses on
regular machines too.  For example:
while(!(user_interrupt))
{ /* do nothing */ }

where user_interrupt is a global variable that is changed by an
asynchrous interrupt (from a keyboard, mouse, etc.).  I'm running on a
standard vaxstation II, so there's no fancy shared memory going on,
and it's only one process that's executing all the code.  I've had
some real problems getting the compiler to do what i want, because it
keeps on wanting to optimize it out of a loop, or into a register, or
something. 






-------
michael j zehr
"My opinions are my own ... as is my spelling."



More information about the Comp.lang.c mailing list