4fb Subj : Re: A question about atomic_ptr To : comp.programming.threads From : Alexander Terekhov Date : Tue Apr 12 2005 02:15 am Alexander Terekhov wrote: > > Peter Dimov wrote: > [...] > > But on the other hand "int" offers "basic" thread safety by default and > > "strong" thread safety if I only touch it with atomic_load_acq and > > atomic_store_rel. > > Only if you properly isolate (align and pad if nessesary) it. And even properly isolated built-in "int" can be accessed on per-bit basis (or per-byte/whatnot, non-atomically) by conforming implementations. Just to be anal, so to speak. > > That's one reason for atomic<> wrapper. > > [...] > > This is also why I'm not particularly fond of Alexander's atomic<> dedicated > > wrapper type. Providing atomic access via ordinary functions seems more > > natural. > > Another reason is to "enforce" proper labeling for all accesses by > making the type opaque. An exclusive access on atomic doesn't > need to be isolated/atomic at all, it can be combined with other > accesses. How are you going to do it all with "extended-for-threads" > C/C++ volatiles (also mentioned by you in another message not here), > for example? > > What else? regards, alexander. . 0