[cpp-threads] Should atomic_add support pointers?
Andrei Alexandrescu
andrei at metalanguage.com
Thu Nov 10 22:23:08 GMT 2005
I think it should; on some systems it's an intrinsic, on others it can
be implemented with CAS. It's a useful operation, and good to let the
library implement it.
Andrei
Peter Dimov wrote:
> I'm trying to nail down the semantics of an atomic ops library and I
> encountered the following interesting issue:
>
> Should atomic_add support pointer addition? That is:
>
> int * p;
>
> atomic_add( &p, 4 ); // allowed? sensible?
>
> What do you think?
>
> --
> Peter Dimov
> http://www.pdimov.com
>
More information about the cpp-threads
mailing list