diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/thread/singleton.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/thread/singleton.h')
-rw-r--r-- | util/thread/singleton.h | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/util/thread/singleton.h b/util/thread/singleton.h index 4a1e05aea0..a9af366005 100644 --- a/util/thread/singleton.h +++ b/util/thread/singleton.h @@ -4,38 +4,38 @@ #include <util/generic/singleton.h> #include <util/generic/ptr.h> -namespace NPrivate { - template <class T, size_t Priority> - struct TFastThreadSingletonHelper { - static inline T* GetSlow() { - return SingletonWithPriority<NTls::TValue<T>, Priority>()->GetPtr(); - } +namespace NPrivate { + template <class T, size_t Priority> + struct TFastThreadSingletonHelper { + static inline T* GetSlow() { + return SingletonWithPriority<NTls::TValue<T>, Priority>()->GetPtr(); + } - static inline T* Get() { + static inline T* Get() { #if defined(Y_HAVE_FAST_POD_TLS) - Y_POD_STATIC_THREAD(T*) fast(nullptr); + Y_POD_STATIC_THREAD(T*) fast(nullptr); if (Y_UNLIKELY(!fast)) { - fast = GetSlow(); - } - - return fast; -#else - return GetSlow(); -#endif - } - }; + fast = GetSlow(); + } + + return fast; +#else + return GetSlow(); +#endif + } + }; } -template <class T, size_t Priority> -static inline T* FastTlsSingletonWithPriority() { - return ::NPrivate::TFastThreadSingletonHelper<T, Priority>::Get(); +template <class T, size_t Priority> +static inline T* FastTlsSingletonWithPriority() { + return ::NPrivate::TFastThreadSingletonHelper<T, Priority>::Get(); } // NB: the singleton is the same for all modules that use // FastTlsSingleton with the same type parameter. If unique singleton // required, use unique types. -template <class T> -static inline T* FastTlsSingleton() { - return FastTlsSingletonWithPriority<T, TSingletonTraits<T>::Priority>(); -} +template <class T> +static inline T* FastTlsSingleton() { + return FastTlsSingletonWithPriority<T, TSingletonTraits<T>::Priority>(); +} |