On Wed, 2006-06-07 at 06:22, Wolfgang Mües wrote: > Rask, > > On Tuesday 06 June 2006 21:33, Rask Ingemann Lambertsen wrote: > > > > + swp%?b\\t%1, %1, %0\;ldr%?b\\t%1, %0" > > > > > > You should get a price for cleverness here! > > > > Thanks! Indeed it looks good until you think of volatile variables. > > Because volatile variables can change their values from another thread, > and the readback will be false. Oh. >
It's quite simple. Declaring a volatile char will be unpredictable in your compilation environment (in the same way as volatile short was on pre-v4 ARM devices). However, for some uses (eg device drivers) you could explicitly use an asm that did a ldrb/strb sequence (if some parts of your memory system support that. R.