Subj : Re: A question about atomic_ptr To : comp.programming.threads From : Peter Dimov Date : Tue Apr 12 2005 02:45 am Joe Seigh wrote: > > You could, though you've in effect merged atomic_ptr and local_ptr > together. As a practical matter, I'd think you'd want some mechanism > to distinguish between shared global pointers and non-shared local > pointers. I'm not sure. I can see how "thread safety is part of the type" can be useful. 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. Of course in Java "int" is basic and "volatile int" is strong. For some reason I think that the "non-Java int" (and raw pointer) semantics make more sense for shared_ptr; it seems sufficiently primitive to me. I may be wrong, of course. 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. .