aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/use_count_checker.cpp
diff options
context:
space:
mode:
authornga <nga@yandex-team.ru>2022-02-10 16:48:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:09 +0300
commit1f553f46fb4f3c5eec631352cdd900a0709016af (patch)
treea231fba2c03b440becaea6c86a2702d0bfb0336e /library/cpp/messagebus/use_count_checker.cpp
parentc4de7efdedc25b49cbea74bd589eecb61b55b60a (diff)
downloadydb-1f553f46fb4f3c5eec631352cdd900a0709016af.tar.gz
Restoring authorship annotation for <nga@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/use_count_checker.cpp')
-rw-r--r--library/cpp/messagebus/use_count_checker.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/messagebus/use_count_checker.cpp b/library/cpp/messagebus/use_count_checker.cpp
index c6243ea21f..5b253aca6f 100644
--- a/library/cpp/messagebus/use_count_checker.cpp
+++ b/library/cpp/messagebus/use_count_checker.cpp
@@ -1,53 +1,53 @@
#include "use_count_checker.h"
#include <util/generic/utility.h>
-#include <util/system/yassert.h>
-
-TUseCountChecker::TUseCountChecker() {
-}
-
-TUseCountChecker::~TUseCountChecker() {
- TAtomicBase count = Counter.Val();
+#include <util/system/yassert.h>
+
+TUseCountChecker::TUseCountChecker() {
+}
+
+TUseCountChecker::~TUseCountChecker() {
+ TAtomicBase count = Counter.Val();
Y_VERIFY(count == 0, "must not release when count is not zero: %ld", (long)count);
-}
-
-void TUseCountChecker::Inc() {
- Counter.Inc();
-}
-
-void TUseCountChecker::Dec() {
- Counter.Dec();
-}
-
-TUseCountHolder::TUseCountHolder()
+}
+
+void TUseCountChecker::Inc() {
+ Counter.Inc();
+}
+
+void TUseCountChecker::Dec() {
+ Counter.Dec();
+}
+
+TUseCountHolder::TUseCountHolder()
: CurrentChecker(nullptr)
{
}
-
-TUseCountHolder::TUseCountHolder(TUseCountChecker* currentChecker)
- : CurrentChecker(currentChecker)
-{
- if (!!CurrentChecker) {
- CurrentChecker->Inc();
- }
-}
-
+
+TUseCountHolder::TUseCountHolder(TUseCountChecker* currentChecker)
+ : CurrentChecker(currentChecker)
+{
+ if (!!CurrentChecker) {
+ CurrentChecker->Inc();
+ }
+}
+
TUseCountHolder::~TUseCountHolder() {
- if (!!CurrentChecker) {
- CurrentChecker->Dec();
- }
-}
-
-TUseCountHolder& TUseCountHolder::operator=(TUseCountHolder that) {
- Swap(that);
- return *this;
-}
-
-void TUseCountHolder::Swap(TUseCountHolder& that) {
- DoSwap(CurrentChecker, that.CurrentChecker);
-}
-
-void TUseCountHolder::Reset() {
- TUseCountHolder tmp;
- Swap(tmp);
-}
+ if (!!CurrentChecker) {
+ CurrentChecker->Dec();
+ }
+}
+
+TUseCountHolder& TUseCountHolder::operator=(TUseCountHolder that) {
+ Swap(that);
+ return *this;
+}
+
+void TUseCountHolder::Swap(TUseCountHolder& that) {
+ DoSwap(CurrentChecker, that.CurrentChecker);
+}
+
+void TUseCountHolder::Reset() {
+ TUseCountHolder tmp;
+ Swap(tmp);
+}