MySQL 8.0.39
Source Code Documentation
lock_free_type.h File Reference

Lock-free type (selection) implementation. More...

#include <atomic>
#include <type_traits>
#include "my_config.h"
#include "storage/temptable/include/temptable/constants.h"

Go to the source code of this file.

Classes

struct  temptable::Lock_free_type_selector< T, V >
 Lock-free type selector, a helper utility which evaluates during the compile-time whether the given type T has a property of being always-lock-free for given platform. More...
 
struct  temptable::Lock_free_type_selector< T, typename std::enable_if< std::is_class< T >::value and std::is_trivially_copyable< T >::value >::type >
 Template-specialization for trivially-copyable classes/structs. More...
 
struct  temptable::Lock_free_type_selector< T, typename std::enable_if< std::is_pointer< T >::value >::type >
 Template-specialization for pointer types. More...
 
struct  temptable::Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, long long >::value or std::is_same< T, unsigned long long >::value >::type >
 Template-specialization for long long types. More...
 
struct  temptable::Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, long >::value or std::is_same< T, unsigned long >::value >::type >
 Template-specialization for long types. More...
 
struct  temptable::Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, int >::value or std::is_same< T, unsigned int >::value >::type >
 Template-specialization for int types. More...
 
struct  temptable::Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, short >::value or std::is_same< T, unsigned short >::value >::type >
 Template-specialization for short types. More...
 
struct  temptable::Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, char >::value or std::is_same< T, unsigned char >::value >::type >
 Template-specialization for char types. More...
 
struct  temptable::Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, bool >::value >::type >
 Template-specialization for boolean types. More...
 
struct  temptable::Largest_lock_free_type_selector< T, V >
 Largest lock-free type selector, a helper utility very much similar to Lock_free_type_selector with the difference being that it tries hard not to fail. More...
 
struct  temptable::Largest_lock_free_type_selector< T, typename std::enable_if< std::is_pointer< T >::value >::type >
 Template-specialization for pointer types. More...
 
struct  temptable::Largest_lock_free_type_selector< T, typename std::enable_if< std::is_integral< T >::value >::type >
 Template-specialization for integral types. More...
 
struct  temptable::Lock_free_type< T, ALIGN, TypeSelector >
 Representation of an atomic type which is guaranteed to be always-lock-free. More...
 
struct  temptable::Lock_free_type< T, Alignment::L1_DCACHE_SIZE, TypeSelector >
 

Namespaces

namespace  temptable
 

Macros

#define WORKAROUND_PR31864_CLANG_BUG   (0)
 Clang has a bug which causes ATOMIC_LLONG_LOCK_FREE to be defined as 1 (or "sometimes lock-free") in 32-bit builds even though __atomic_always_lock_free returns true for the same type on the same platform. More...
 

Enumerations

enum class  temptable::Alignment { temptable::NATURAL , temptable::L1_DCACHE_SIZE }
 Enum class describing alignment-requirements. More...
 

Detailed Description

Lock-free type (selection) implementation.

Macro Definition Documentation

◆ WORKAROUND_PR31864_CLANG_BUG

#define WORKAROUND_PR31864_CLANG_BUG   (0)

Clang has a bug which causes ATOMIC_LLONG_LOCK_FREE to be defined as 1 (or "sometimes lock-free") in 32-bit builds even though __atomic_always_lock_free returns true for the same type on the same platform.

This is an inconsistency which can be easily verified by:

% clang -dM -E -x c /dev/null | grep LLONG_LOCK define __CLANG_ATOMIC_LLONG_LOCK_FREE 2 define __GCC_ATOMIC_LLONG_LOCK_FREE 2

% clang -m32 -dM -E -x c /dev/null | grep LLONG_LOCK define __CLANG_ATOMIC_LLONG_LOCK_FREE 1 define __GCC_ATOMIC_LLONG_LOCK_FREE 1

% gcc -dM -E -x c /dev/null | grep LLONG_LOCK define __GCC_ATOMIC_LLONG_LOCK_FREE 2

% gcc -m32 -dM -E -x c /dev/null | grep LLONG_LOCK define __GCC_ATOMIC_LLONG_LOCK_FREE 2

There has been some work towards fixing this issue:

Some more links: