volatile
The
volatile keyword is used on variables that may
be modified simultaneously by other threads. This warns the compiler to fetch
them fresh each time, rather than caching them in registers. This also inhibits
certain optimisations that assume no other thread will change the values
unexpectedly. Since other threads cannot see local variables, there is never any
need to mark local variables
volatile.
quote from:
http://mindprod.com/jgloss/volatile.html