39f Subj : Re: 'volatile' Rules To : comp.programming.threads From : Marcin 'Qrczak' Kowalczyk Date : Tue Jun 07 2005 07:46 pm "Uenal Mutlu" <520001085531-0001@t-online.de> writes: > There seems indeed be no good reason to use volatile: > it's unsafe/unreliable/unpredictable and a performance killer, > in short: totally useless. > Maybe someone can list when it is ever useful, if any. It is useful for communication between a Unix signal handler and the main program (they should run in the same thread). setjmp requires volatile on local variables of the function performing setjmp if their values should be correctly preserved across longjmp. volatile might be useful for memory mapped files, to ensure that intermediate states in the middle of operations look predictably. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ . 0