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 | 06361c53c4ca58f57007ea73fc399fc25664f13c (patch) | |
tree | f5df3a0e589db8e1e30dca616e6fa2d10bf3c64a /util/generic | |
parent | 94e51c602b555459333b3c6ae92476c424c930bc (diff) | |
download | ydb-06361c53c4ca58f57007ea73fc399fc25664f13c.tar.gz |
Restoring authorship annotation for <alexeykruglov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r-- | util/generic/ptr.h | 10 | ||||
-rw-r--r-- | util/generic/refcount.h | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 19db0e3ec5..9127163c1c 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -31,16 +31,16 @@ template <class T> inline void CheckedDelete(T* t) { AssertTypeComplete<T>(); - delete t; -} - + delete t; +} + template <class T> inline void CheckedArrayDelete(T* t) { AssertTypeComplete<T>(); delete[] t; -} - +} + class TNoAction { public: template <class T> diff --git a/util/generic/refcount.h b/util/generic/refcount.h index 966e853b77..558e6c3cbe 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>; |