maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #06688
Re: [Commits] Rev 3965: MDEV-5403 - Reduce usage of LOCK_open: tc_count in lp:maria/10.0
Hi Kristian,
thanks for your feedback. Yes I added these templates to hide data type
and warapping in locks, which I still find reasonable.
OTOH I also hid the fact of use of atomic ops. I tend to agree it is wrong.
Do you think keeping the former and fixing the latter is acceptable?
Thanks,
Sergey
On Fri, Jan 24, 2014 at 09:05:04AM +0100, Kristian Nielsen wrote:
> Sergey Vojtovich <svoj@xxxxxxxxxxx> writes:
>
> > +#ifdef __cplusplus
> > +template <typename T, int S> class Atomic_type_triat;
> > +
> > +
> > +template <typename T> class Atomic_type_triat<T, 4>
>
> > +template <typename T> class Atomic_type_triat<T, 8>
>
> > +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!
>
> - Kristian.
Follow ups
References