Boost logo

Boost :

From: Chris Thomasson (cristom_at_[hidden])
Date: 2006-11-16 19:10:27

"Roland Schwarz" <roland.schwarz_at_[hidden]> wrote in message
> Chris Thomasson wrote:
>> Here is how I define rules for my atomic<T>:
>> Can't use any constructors, destructors, base classes, virtual functions,
>> or anything else that violates POD requirements.
>> Can't use any operators
> Hmm, what is your rationale for this choice?

What are the memory barrier characteristics' of all the operators that make
store/load to/from the user provided T POD type? I would assume they are
naked... How would you define them?

> I would have expected that you will need the POD
> requirements only for type T, not for atomic<T>.

Template function API sounds better than atomic<T> class that holds a member
of type T. Define a rule that states that T must be a POD, and must be a
type that can be atomically modified by the target architecture. The latter
can be handled with arch-specific template metaprogramming, the former can
be handled with an undefined behavior clause.

Boost list run by bdawes at, gregod at, cpdaniel at, john at