Skip to content

Commit 7debbd7

Browse files
committed
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.
1 parent 075820a commit 7debbd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

storage/innobase/include/ut0counter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ struct ib_counter_t {
108108

109109
private:
110110
/** Atomic which occupies whole CPU cache line */
111-
struct MY_ALIGNED(CACHE_LINE_SIZE) ib_counter_element_t {
111+
union ib_counter_element_t {
112112
std::atomic<Type> value;
113-
byte padding[CACHE_LINE_SIZE - sizeof(value)];
113+
byte padding[CACHE_LINE_SIZE];
114114
};
115115
static_assert(sizeof(ib_counter_element_t) == CACHE_LINE_SIZE, "");
116116

117117
/** Array of counter elements */
118-
ib_counter_element_t m_counter[N];
118+
MY_ALIGNED(CACHE_LINE_SIZE) ib_counter_element_t m_counter[N];
119119
};
120120

121121
#endif /* ut0counter_h */

0 commit comments

Comments
 (0)