diff options
author | ivanzhukov <ivanzhukov@yandex-team.ru> | 2022-02-10 16:49:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:40 +0300 |
commit | 0892d79ab411592ad25175c4bdadbcb09b466cf5 (patch) | |
tree | 98dfdd45463c9bd747101748a9ca25d2917390fd /library/cpp/monlib/metrics/metric.h | |
parent | 1b7466cb957659079ebebbb5d76e64e51f3306f0 (diff) | |
download | ydb-0892d79ab411592ad25175c4bdadbcb09b466cf5.tar.gz |
Restoring authorship annotation for <ivanzhukov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/monlib/metrics/metric.h')
-rw-r--r-- | library/cpp/monlib/metrics/metric.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/library/cpp/monlib/metrics/metric.h b/library/cpp/monlib/metrics/metric.h index b8ce12d753..d91dbac9a2 100644 --- a/library/cpp/monlib/metrics/metric.h +++ b/library/cpp/monlib/metrics/metric.h @@ -152,14 +152,14 @@ namespace NMonitoring { double Add(double n) noexcept override { double newValue; double oldValue = Get(); - - do { + + do { newValue = oldValue + n; } while (!Value_.compare_exchange_weak(oldValue, newValue, std::memory_order_release, std::memory_order_consume)); - + return newValue; - } - + } + void Set(double n) noexcept override { Value_.store(n, std::memory_order_relaxed); } @@ -209,8 +209,8 @@ namespace NMonitoring { i64 Add(i64 n) noexcept override { return Value_.fetch_add(n, std::memory_order_relaxed) + n; - } - + } + void Set(i64 value) noexcept override { Value_.store(value, std::memory_order_relaxed); } |