Marko Mäkelä <marko.makela@mariadb.com> writes:
I am successfully using a dirty trick like this: static SHOW_VAR innodb_status_variables[]= { … {"ibuf_merges", &ibuf.n_merges, SHOW_SIZE_T}, … {NullS, NullS, SHOW_LONG} };
The underlying C-style cast simply assumes that the Atomic_counter<ulint> can be read as a normal ulint (which is an alias for size_t). Theoretically, it might not work on some exotic
Oh! I see. Basically, I first used std::atomic<ulong>, then found the problem that MYSQL_SYSVAR_ENUM() expected a plain ulong *. And I didn't want to introduce the (theoretically) illegal cast, so used the old my_atomic_* interface instead. But if we're already doing those casts elsewhere, that could work too I guess. It's really only code style here. The accesses to that option are all under LOCK_log, except the one dirty read I add. And if the dirty read would somehow conflict with an update, it will be re-checked and corrected under LOCK_log anyway. And read/write of aligned long is atomic anyway by default on all relevant platforms. - Kristian.