Hi, Kristian!

On Jan 24, Kristian Nielsen wrote:
> Sergey Vojtovich <[email protected]> writes:
> 
> > +template <typename T, typename S= Atomic_type_triat<T, sizeof(T)> > class 
> > Atomic
> 
> > +  T operator++() { return add(1) + 1; }
> 
> [lots and lots of more template code snipped]
> 
> I am vetoing this.
> 
> We really, _really_ do not want to package up the atomic stuff in even more
> abstractions and API layers than we already have.
> 
> Atomics and lock-free stuff is in itself plenty complicated. It is crucial
> that one can at least see easily in the code what is going on, without also
> having to spend effort to understand multiple layers of wrapping.
> 
> As far as I can see, the only thing the templates do is hide stuff (like the
> data type used and the wrapping in locks on platforms without atomic
> support?), while what we need is to make those details clear to people reading
> the code, not to hide them!

I partially agree. I don't like that

  a++;

may be an atomic operation intenally. But I do like that one can write

  my_atomic_add(a, 1); // for example

without explicitly specifying the bit width of the 'a'.
This is pretty standard feature, it works even in assembler :)

Regards,
Sergei


_______________________________________________
Mailing list: https://launchpad.net/~maria-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to