On Mon, Aug 9, 2010 at 9:55 AM, Lutger <[email protected]> wrote: > > I'm not an expert on this, but if I am not mistaken the shared type qualifier > will handle the barriers, require atomic ops and prevent reordering compiler > optimizations so it looks like this one will take care of what volatile used > to > do, right? > >
Right, shared sounds better. However, atomics must not sneak in: * Many processors do not support atomics Even with processor support, * Many device interconnects do not support atomic transactions Even with interconnect support, * Many devices do not support atomic transactions and will just generate a bus error So long as code does not attempt a read-modify-write operation, shared has the opportunity to do the right thing, namely implement volatile semantics. Cases with volatile read-modify-write would have to be split -- awkward, but maybe ok? asm() hacks to fake volatile are too embarrassing to consider in a promising new systems language! -steve
