2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Avoid an extra atomic_load() call

This commit is contained in:
Ondřej Surý
2019-11-06 10:49:28 +01:00
parent 3361247519
commit b4df5a6ecb

View File

@@ -157,15 +157,12 @@ void isc_stats_update_if_greater(isc_stats_t *stats,
REQUIRE(ISC_STATS_VALID(stats));
REQUIRE(counter < stats->ncounters);
isc_statscounter_t curr_value;
isc_statscounter_t curr_value =
atomic_load_relaxed(&stats->counters[counter]);
do {
curr_value = atomic_load_explicit(&stats->counters[counter],
memory_order_relaxed);
if (curr_value >= value) {
break;
}
} while (!atomic_compare_exchange_strong(&stats->counters[counter],
&curr_value,
value));