Subj : Re: volatile or mutex To : comp.programming.threads From : David Schwartz Date : Wed May 11 2005 09:26 pm "marri" wrote in message news:1115859714.056736.259220@g14g2000cwa.googlegroups.com... > Do we need to use volatile or a mutex to synchronize read/write of an > integer variable??. If you need guaranteed sensible behavior, you need a mutex. > Found that people defile volatile for a boolean variable and > synchronize using mutex for integer variables is there any good > reason?? If you don't need guaranteed sensible behavior, then you don't need a mutex. If a boolean is used just to shut something down, then a volatile boolean might work just fine on some platforms with some compilers. Generally when you use an integer, you need more guarantees than 'volatile' can provide. DS .