Use macros to register boxed types thread safely