MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / update_min_max_atomic

Function update_min_max_atomic

deps/hdr_histogram/hdr_histogram.c:83–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83static void update_min_max_atomic(struct hdr_histogram* h, int64_t value)
84{
85 int64_t current_min_value;
86 int64_t current_max_value;
87 do
88 {
89 current_min_value = hdr_atomic_load_64(&h->min_value);
90
91 if (0 == value || current_min_value <= value)
92 {
93 break;
94 }
95 }
96 while (!hdr_atomic_compare_exchange_64(&h->min_value, &current_min_value, value));
97
98 do
99 {
100 current_max_value = hdr_atomic_load_64(&h->max_value);
101
102 if (value <= current_max_value)
103 {
104 break;
105 }
106 }
107 while (!hdr_atomic_compare_exchange_64(&h->max_value, &current_max_value, value));
108}
109
110
111/* ## ## ######## #### ## #### ######## ## ## */

Callers 1

hdr_record_values_atomicFunction · 0.85

Calls 2

hdr_atomic_load_64Function · 0.85

Tested by

no test coverage detected