Fix a compilation error

ib_counter_t::ib_counter_element_t: Avoid sizeof on a std::atomic type,
because it causes errors on some version of the Microsoft compiler.
This commit is contained in:
Marko Mäkelä 2018-11-18 15:50:43 +02:00
parent 075820ab23
commit 7debbd7859

View file

@ -108,14 +108,14 @@ struct ib_counter_t {
private:
/** Atomic which occupies whole CPU cache line */
struct MY_ALIGNED(CACHE_LINE_SIZE) ib_counter_element_t {
union ib_counter_element_t {
std::atomic<Type> value;
byte padding[CACHE_LINE_SIZE - sizeof(value)];
byte padding[CACHE_LINE_SIZE];
};
static_assert(sizeof(ib_counter_element_t) == CACHE_LINE_SIZE, "");
/** Array of counter elements */
ib_counter_element_t m_counter[N];
MY_ALIGNED(CACHE_LINE_SIZE) ib_counter_element_t m_counter[N];
};
#endif /* ut0counter_h */