[cpp-threads] atomic operations package
Peter Dimov
pdimov at mmltd.net
Tue Aug 23 18:42:29 BST 2005
Alexander Terekhov wrote:
> On 8/23/05, Boehm, Hans <hans.boehm at hp.com> wrote:
>> 1) You make the ordering constraint a run-time parameter, and I make
>> it a member template parameter. My guess is that you almost never
>> want it to be a runtime parameter.
>
> It's not really meant to be a run-time parameter. It just takes a bit
> less characters and is more readable IMO.
I prefer the "runtime" formulation and not using an atomic<> template
because this keeps the syntax C-compatible. The atomics should - in my
opinion - be implemented as compiler intrinsics; these are usually shared
between the C and C++ compiler.
The C people would never accept the <> syntax. They hate templates with a
passion. :-)
atomic_load( &v, msync_acq )
is C-friendly. (That's also why v is passed by pointer and not by
reference.)
More information about the cpp-threads
mailing list