Commit b4df5a6e authored by Ondřej Surý's avatar Ondřej Surý

Avoid an extra atomic_load() call

parent 33612475
Pipeline #24978 passed with stages
in 42 minutes
...@@ -157,15 +157,12 @@ void isc_stats_update_if_greater(isc_stats_t *stats, ...@@ -157,15 +157,12 @@ void isc_stats_update_if_greater(isc_stats_t *stats,
REQUIRE(ISC_STATS_VALID(stats)); REQUIRE(ISC_STATS_VALID(stats));
REQUIRE(counter < stats->ncounters); REQUIRE(counter < stats->ncounters);
isc_statscounter_t curr_value; isc_statscounter_t curr_value =
atomic_load_relaxed(&stats->counters[counter]);
do { do {
curr_value = atomic_load_explicit(&stats->counters[counter],
memory_order_relaxed);
if (curr_value >= value) { if (curr_value >= value) {
break; break;
} }
} while (!atomic_compare_exchange_strong(&stats->counters[counter], } while (!atomic_compare_exchange_strong(&stats->counters[counter],
&curr_value, &curr_value,
value)); value));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment