Hi Sergei, On Tue, Dec 10, 2013 at 05:29:42PM +0100, Sergei Golubchik wrote:
Hi, Sergey!
Not a review, only a comment on TDC_atomic part:
1. This is perfectly generally useful, not TDC specific at all. I'd consider moving it to my_atomic.h under #ifdef __cplusplus I was thinking about sql_atomic.h. But you're right - it might be useful in mysys as well.
2. These are supposed to be trivial inlined functions. I don't think you should use inheritance and virtual methods here. Everything should be in the template. Agree. Because of this complexity some functions are not inlined.
I understand that function names (add64/add32/etc) are a bit tricky. Two approaches: pass them as template parameters (like in template <typename T, ADD, CAS, ...>) or - perhaps, if you put this into my_atomic.h you'll be able to generate the necessary code without using my_atomic_add32/etc ? Yes, I will try to come up with some better solution. I'd like to offload most of the work to this Atomic template, something like: Atomic<int> a; Atomic<ulonglong> b; Atomic<void*> c;
So that it can pick proper low-level functions without bothering template user. I was thinking about using integer template arguments, but didn't yet managed to create anything meaningful from it: template <typename T, int S= sizeof(T)> class Atomic ... Regards, Sergey