MySQL 8.4.2
Source Code Documentation
|
Light-weight and type-safe wrapper around the PSI_memory_key that eliminates the possibility of introducing silent bugs through the course of implicit conversions and makes them show up as compile-time errors. More...
#include <ut0new.h>
Public Member Functions | |
PSI_memory_key_t (PSI_memory_key key) | |
PSI_memory_key | operator() () const |
Public Attributes | |
PSI_memory_key | m_key |
Light-weight and type-safe wrapper around the PSI_memory_key that eliminates the possibility of introducing silent bugs through the course of implicit conversions and makes them show up as compile-time errors.
Without this wrapper it was possible to say: aligned_alloc_withkey(10*sizeof(int), key, 64)) Which would unfortunately compile just fine but it would silently introduce a bug because it confuses the order of 10*sizeof(int) and key input arguments. Both of them are unsigned types.
With the wrapper, aligned_alloc_withkey(10*sizeof(int), key, 64)) now results with a compile-time error and the only proper way to accomplish the original intent is to use PSI_memory_key_t wrapper like so: aligned_alloc_withkey(PSI_memory_key_t{key}, 10*sizeof(int), 64))
Or by making use of the convenience function to create one: aligned_alloc_withkey(make_psi_memory_key(key), 10*sizeof(int), 64))
|
inlineexplicit |
|
inline |
PSI_memory_key ut::PSI_memory_key_t::m_key |