diff options
author | desertfury <desertfury@yandex-team.ru> | 2022-02-10 16:50:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:15 +0300 |
commit | c0fb261e6889e12b418ebcdfdb3c990a4b39fd75 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | ba92f2f3d8a0cfa549b668980b868cbb6ff080ce (diff) | |
download | ydb-c0fb261e6889e12b418ebcdfdb3c990a4b39fd75.tar.gz |
Restoring authorship annotation for <desertfury@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | build/scripts/copy_to_dir.py | 6 | ||||
-rw-r--r-- | library/cpp/cache/thread_safe_cache.h | 4 | ||||
-rw-r--r-- | util/network/address.cpp | 2 | ||||
-rw-r--r-- | util/network/address_ut.cpp | 16 | ||||
-rw-r--r-- | util/thread/pool.h | 68 |
5 files changed, 48 insertions, 48 deletions
diff --git a/build/scripts/copy_to_dir.py b/build/scripts/copy_to_dir.py index 57bd46f6d7..9baeb5ffac 100644 --- a/build/scripts/copy_to_dir.py +++ b/build/scripts/copy_to_dir.py @@ -48,9 +48,9 @@ def main(): dest_arch = None if opts.dest_arch: if opts.dest_arch.endswith('.tar'): - dest_arch = tarfile.open(opts.dest_arch, 'w', dereference=True) + dest_arch = tarfile.open(opts.dest_arch, 'w', dereference=True) elif opts.dest_arch.endswith('.tar.gz') or opts.dest_arch.endswith('.tgz'): - dest_arch = tarfile.open(opts.dest_arch, 'w:gz', dereference=True) + dest_arch = tarfile.open(opts.dest_arch, 'w:gz', dereference=True) else: # TODO: move check to graph generation stage raise Exception('Unsopported archive type for {}. Use one of: tar, tar.gz, tgz.'.format(os.path.basename(opts.dest_arch))) @@ -60,7 +60,7 @@ def main(): if dst.startswith(opts.build_root): dst = dst[len(opts.build_root) + 1:] - if dest_arch and not arg.endswith('.pkg.fake'): + if dest_arch and not arg.endswith('.pkg.fake'): dest_arch.add(arg, arcname=dst) dst = os.path.join(opts.dest_dir, dst) diff --git a/library/cpp/cache/thread_safe_cache.h b/library/cpp/cache/thread_safe_cache.h index e071605259..71e1442717 100644 --- a/library/cpp/cache/thread_safe_cache.h +++ b/library/cpp/cache/thread_safe_cache.h @@ -135,7 +135,7 @@ namespace NPrivate { } private: - using TInternalCache = TCache<Key, TPtr, List<Key, TPtr>, TNoopDelete>; + using TInternalCache = TCache<Key, TPtr, List<Key, TPtr>, TNoopDelete>; template <class TCallbacks> class TThreadSafeCacheSingleton { @@ -165,7 +165,7 @@ namespace NPrivate { private: TRWMutex Mutex; const ICallbacks& Callbacks; - mutable TInternalCache Cache; + mutable TInternalCache Cache; }; struct TLWHelper { diff --git a/util/network/address.cpp b/util/network/address.cpp index 0c1bfbe3e6..a81a9e6994 100644 --- a/util/network/address.cpp +++ b/util/network/address.cpp @@ -160,7 +160,7 @@ static const in6_addr& In6Addr(const IRemoteAddr& addr) { bool NAddr::IsLoopback(const IRemoteAddr& addr) { if (addr.Addr()->sa_family == AF_INET) { - return ((ntohl(InAddr(addr).s_addr) >> 24) & 0xff) == 127; + return ((ntohl(InAddr(addr).s_addr) >> 24) & 0xff) == 127; } if (addr.Addr()->sa_family == AF_INET6) { diff --git a/util/network/address_ut.cpp b/util/network/address_ut.cpp index 2f37fbee9d..28f45172ff 100644 --- a/util/network/address_ut.cpp +++ b/util/network/address_ut.cpp @@ -28,12 +28,12 @@ Y_UNIT_TEST_SUITE(IRemoteAddr_ToString) { TString toString = ToString((const IRemoteAddr&)TAddrInfo(&*it)); UNIT_ASSERT_VALUES_EQUAL(TString("[::1]:22"), toString); } - - Y_UNIT_TEST(Loopback) { - TNetworkAddress localAddress("127.70.0.1", 22); - UNIT_ASSERT_VALUES_EQUAL(NAddr::IsLoopback(TAddrInfo(&*localAddress.Begin())), true); - - TNetworkAddress localAddress2("127.0.0.1", 22); - UNIT_ASSERT_VALUES_EQUAL(NAddr::IsLoopback(TAddrInfo(&*localAddress2.Begin())), true); - } + + Y_UNIT_TEST(Loopback) { + TNetworkAddress localAddress("127.70.0.1", 22); + UNIT_ASSERT_VALUES_EQUAL(NAddr::IsLoopback(TAddrInfo(&*localAddress.Begin())), true); + + TNetworkAddress localAddress2("127.0.0.1", 22); + UNIT_ASSERT_VALUES_EQUAL(NAddr::IsLoopback(TAddrInfo(&*localAddress2.Begin())), true); + } } diff --git a/util/thread/pool.h b/util/thread/pool.h index 9dbc4395fd..d1ea3a67cb 100644 --- a/util/thread/pool.h +++ b/util/thread/pool.h @@ -55,31 +55,31 @@ class TThreadPoolException: public yexception { template <class T> class TThrFuncObj: public IObjectInQueue { -public: - TThrFuncObj(const T& func) +public: + TThrFuncObj(const T& func) : Func(func) { - } - - TThrFuncObj(T&& func) + } + + TThrFuncObj(T&& func) : Func(std::move(func)) { - } - - void Process(void*) override { - THolder<TThrFuncObj> self(this); - Func(); - } - -private: - T Func; -}; - + } + + void Process(void*) override { + THolder<TThrFuncObj> self(this); + Func(); + } + +private: + T Func; +}; + template <class T> -IObjectInQueue* MakeThrFuncObj(T&& func) { - return new TThrFuncObj<std::remove_cv_t<std::remove_reference_t<T>>>(std::forward<T>(func)); -} - +IObjectInQueue* MakeThrFuncObj(T&& func) { + return new TThrFuncObj<std::remove_cv_t<std::remove_reference_t<T>>>(std::forward<T>(func)); +} + struct TThreadPoolParams { bool Catching_ = true; bool Blocking_ = false; @@ -147,12 +147,12 @@ public: * version of Add*(), but use exceptions instead returning false */ void SafeAdd(IObjectInQueue* obj); - + template <class T> - void SafeAddFunc(T&& func) { + void SafeAddFunc(T&& func) { Y_ENSURE_EX(AddFunc(std::forward<T>(func)), TThreadPoolException() << TStringBuf("can not add function to queue")); - } - + } + void SafeAddAndOwn(THolder<IObjectInQueue> obj); /** @@ -162,17 +162,17 @@ public: * @return false if queue is full or shutting down */ virtual bool Add(IObjectInQueue* obj) Y_WARN_UNUSED_RESULT = 0; - + template <class T> - Y_WARN_UNUSED_RESULT bool AddFunc(T&& func) { - THolder<IObjectInQueue> wrapper(MakeThrFuncObj(std::forward<T>(func))); - bool added = Add(wrapper.Get()); - if (added) { - Y_UNUSED(wrapper.Release()); - } - return added; - } - + Y_WARN_UNUSED_RESULT bool AddFunc(T&& func) { + THolder<IObjectInQueue> wrapper(MakeThrFuncObj(std::forward<T>(func))); + bool added = Add(wrapper.Get()); + if (added) { + Y_UNUSED(wrapper.Release()); + } + return added; + } + bool AddAndOwn(THolder<IObjectInQueue> obj) Y_WARN_UNUSED_RESULT; virtual void Start(size_t threadCount, size_t queueSizeLimit = 0) = 0; /** Wait for completion of all scheduled objects, and then exit */ |