We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d5234a7 commit 758b3a9Copy full SHA for 758b3a9
include/ylt/metric/summary_impl.hpp
@@ -170,13 +170,14 @@ class summary_impl {
170
};
171
172
data_t& get_data() {
173
- data_t* data = data_[frontend_data_index_];
+ auto index = frontend_data_index_.load();
174
+ data_t* data = data_[index];
175
if (data == nullptr) [[unlikely]] {
176
auto pointer = new data_t{};
- if (!data_[frontend_data_index_].compare_exchange_strong(data, pointer)) {
177
+ if (!data_[index].compare_exchange_strong(data, pointer)) {
178
delete pointer;
179
}
- return *data_[frontend_data_index_];
180
+ return *data_[index];
181
182
else {
183
return *data;
0 commit comments