diff options
author | alexeykruglov <alexeykruglov@yandex-team.ru> | 2022-02-10 16:45:38 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:38 +0300 |
commit | f64e95a9eb9ab03240599eb9581c5a9102426a96 (patch) | |
tree | b2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /util/generic/refcount.h | |
parent | 06361c53c4ca58f57007ea73fc399fc25664f13c (diff) | |
download | ydb-f64e95a9eb9ab03240599eb9581c5a9102426a96.tar.gz |
Restoring authorship annotation for <alexeykruglov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/refcount.h')
-rw-r--r-- | util/generic/refcount.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/util/generic/refcount.h b/util/generic/refcount.h index 558e6c3cbe..966e853b77 100644 --- a/util/generic/refcount.h +++ b/util/generic/refcount.h @@ -3,7 +3,7 @@ #include <util/system/guard.h> #include <util/system/atomic.h> #include <util/system/defaults.h> -#include <util/system/yassert.h> +#include <util/system/yassert.h> template <class TCounterCheckPolicy> class TSimpleCounterTemplate: public TCounterCheckPolicy { @@ -55,14 +55,14 @@ public: private: TAtomicBase Counter_; }; - + class TNoCheckPolicy { protected: inline void Check() const { } }; -#if defined(SIMPLE_COUNTER_THREAD_CHECK) +#if defined(SIMPLE_COUNTER_THREAD_CHECK) #include <util/system/thread.i> @@ -71,18 +71,18 @@ public: inline TCheckPolicy() { ThreadId = SystemCurrentThreadId(); } - + protected: inline void Check() const { Y_VERIFY(ThreadId == SystemCurrentThreadId(), "incorrect usage of TSimpleCounter"); } - + private: size_t ThreadId; }; -#else +#else using TCheckPolicy = TNoCheckPolicy; -#endif +#endif // Use this one if access from multiple threads to your pointer is an error and you want to enforce thread checks using TSimpleCounter = TSimpleCounterTemplate<TCheckPolicy>; |