diff options
| author | risenberg <[email protected]> | 2022-02-10 16:49:48 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:49:48 +0300 | 
| commit | 99ac40630808727955ac0448822228528f1ea92d (patch) | |
| tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/generic/refcount.h | |
| parent | ec551e975caf33bd88e2803b55464cad608e2441 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/generic/refcount.h')
| -rw-r--r-- | util/generic/refcount.h | 46 | 
1 files changed, 23 insertions, 23 deletions
diff --git a/util/generic/refcount.h b/util/generic/refcount.h index d6b857e6c1b..966e853b77f 100644 --- a/util/generic/refcount.h +++ b/util/generic/refcount.h @@ -8,7 +8,7 @@  template <class TCounterCheckPolicy>  class TSimpleCounterTemplate: public TCounterCheckPolicy {      using TCounterCheckPolicy::Check; -  +  public:      inline TSimpleCounterTemplate(long initial = 0) noexcept          : Counter_(initial) @@ -54,41 +54,41 @@ public:  private:      TAtomicBase Counter_; -};  - -class TNoCheckPolicy {  -protected:  -    inline void Check() const {  -    }  -};  -  +}; + +class TNoCheckPolicy { +protected: +    inline void Check() const { +    } +}; +  #if defined(SIMPLE_COUNTER_THREAD_CHECK)      #include <util/system/thread.i> -class TCheckPolicy {  -public:  -    inline TCheckPolicy() {  -        ThreadId = SystemCurrentThreadId();  -    }  +class TCheckPolicy { +public: +    inline TCheckPolicy() { +        ThreadId = SystemCurrentThreadId(); +    } -protected:  -    inline void Check() const {  +protected: +    inline void Check() const {          Y_VERIFY(ThreadId == SystemCurrentThreadId(), "incorrect usage of TSimpleCounter"); -    }  +    } -private:  -    size_t ThreadId;  -};  +private: +    size_t ThreadId; +};  #else  using TCheckPolicy = TNoCheckPolicy;  #endif -// Use this one if access from multiple threads to your pointer is an error and you want to enforce thread checks  +// 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>; -// Use this one if you do want to share the pointer between threads, omit thread checks and do the synchronization yourself  +// Use this one if you do want to share the pointer between threads, omit thread checks and do the synchronization yourself  using TExplicitSimpleCounter = TSimpleCounterTemplate<TNoCheckPolicy>; -  +  template <class TCounterCheckPolicy>  struct TCommonLockOps<TSimpleCounterTemplate<TCounterCheckPolicy>> {      static inline void Acquire(TSimpleCounterTemplate<TCounterCheckPolicy>* t) noexcept {  | 
