diff options
author | omakovski <omakovski@yandex-team.ru> | 2022-02-10 16:49:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:30 +0300 |
commit | 5feb3b4d96aaa42ce546426241c48d626e6d6685 (patch) | |
tree | 728359f39c2eeab2b894f3d8664ea1499ffde216 | |
parent | 077ab504815199e62ffc54daee873cf1d6b64297 (diff) | |
download | ydb-5feb3b4d96aaa42ce546426241c48d626e6d6685.tar.gz |
Restoring authorship annotation for <omakovski@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | library/cpp/balloc/balloc.cpp | 6 | ||||
-rw-r--r-- | library/cpp/iterator/mapped.h | 6 | ||||
-rw-r--r-- | library/cpp/lfalloc/lf_allocX64.h | 16 | ||||
-rw-r--r-- | library/cpp/malloc/ya.make | 6 | ||||
-rw-r--r-- | library/cpp/tvmauth/client/misc/threaded_updater.cpp | 12 | ||||
-rw-r--r-- | library/cpp/tvmauth/client/misc/threaded_updater.h | 16 | ||||
-rw-r--r-- | library/cpp/tvmauth/client/misc/tool/settings.cpp | 4 | ||||
-rw-r--r-- | library/cpp/tvmauth/client/misc/tool/settings.h | 42 | ||||
-rw-r--r-- | library/cpp/tvmauth/client/misc/tool/threaded_updater.cpp | 2 | ||||
-rw-r--r-- | library/cpp/tvmauth/client/misc/tool/threaded_updater.h | 2 | ||||
-rw-r--r-- | library/cpp/tvmauth/client/ut/tvmtool_updater_ut.cpp | 2 | ||||
-rw-r--r-- | util/memory/pool.cpp | 10 | ||||
-rw-r--r-- | util/memory/pool.h | 22 | ||||
-rw-r--r-- | util/memory/pool_ut.cpp | 80 | ||||
-rw-r--r-- | util/system/thread.cpp | 2 | ||||
-rw-r--r-- | util/thread/lfqueue.h | 44 |
16 files changed, 136 insertions, 136 deletions
diff --git a/library/cpp/balloc/balloc.cpp b/library/cpp/balloc/balloc.cpp index fab489db4c..61963a3a81 100644 --- a/library/cpp/balloc/balloc.cpp +++ b/library/cpp/balloc/balloc.cpp @@ -42,9 +42,9 @@ namespace NBalloc { memset(ptr, 0xde, size - signature); #endif FreeRaw(allocHeader->Block); - if (NAllocStats::IsEnabled()) { - NAllocStats::DecThreadAllocStats(size - signature); - } + if (NAllocStats::IsEnabled()) { + NAllocStats::DecThreadAllocStats(size - signature); + } } else if (signature == DISABLED_SIGNATURE) { LibcFree(allocHeader->Block); } else { diff --git a/library/cpp/iterator/mapped.h b/library/cpp/iterator/mapped.h index 6c5e763184..486ff7583a 100644 --- a/library/cpp/iterator/mapped.h +++ b/library/cpp/iterator/mapped.h @@ -68,9 +68,9 @@ public: TSelf operator+(difference_type n) const { return TSelf(Iter + n, Mapper); } - TSelf operator-(difference_type n) const { - return TSelf(Iter - n, Mapper); - } + TSelf operator-(difference_type n) const { + return TSelf(Iter - n, Mapper); + } difference_type operator-(const TSelf& other) const { return Iter - other.Iter; } diff --git a/library/cpp/lfalloc/lf_allocX64.h b/library/cpp/lfalloc/lf_allocX64.h index fd2a906d6f..6d0c3784de 100644 --- a/library/cpp/lfalloc/lf_allocX64.h +++ b/library/cpp/lfalloc/lf_allocX64.h @@ -127,7 +127,7 @@ static bool FillMemoryOnAllocation = true; static bool TransparentHugePages = false; // force MADV_HUGEPAGE for large allocs static bool MapHugeTLB = false; // force MAP_HUGETLB for small allocs static bool EnableDefrag = true; - + // Buffers that are larger than this size will not be filled with 0xcf #ifndef DBG_FILL_MAX_SIZE #define DBG_FILL_MAX_SIZE 0x01000000000000ULL @@ -379,9 +379,9 @@ static char* AllocWithMMap(uintptr_t sz, EMMapMode mode) { NMalloc::AbortFromCorruptedAllocator("out of working set, something has broken"); #else char* largeBlock = AllocWithMMapLinuxImpl(sz, mode); - if (TransparentHugePages) { - madvise(largeBlock, sz, MADV_HUGEPAGE); - } + if (TransparentHugePages) { + madvise(largeBlock, sz, MADV_HUGEPAGE); + } #endif #endif Y_ASSERT_NOBT(largeBlock); @@ -1823,10 +1823,10 @@ static bool LFAlloc_SetParam(const char* param, const char* value) { return true; } #endif - if (!strcmp(param, "TransparentHugePages")) { - TransparentHugePages = !strcmp(value, "true"); - return true; - } + if (!strcmp(param, "TransparentHugePages")) { + TransparentHugePages = !strcmp(value, "true"); + return true; + } if (!strcmp(param, "MapHugeTLB")) { MapHugeTLB = !strcmp(value, "true"); return true; diff --git a/library/cpp/malloc/ya.make b/library/cpp/malloc/ya.make index 0ec9db71d2..80ee9e33f3 100644 --- a/library/cpp/malloc/ya.make +++ b/library/cpp/malloc/ya.make @@ -19,8 +19,8 @@ IF (NOT OS_WINDOWS) RECURSE( calloc calloc/tests - calloc/calloc_profile_diff - calloc/calloc_profile_scan - calloc/calloc_profile_scan/ut + calloc/calloc_profile_diff + calloc/calloc_profile_scan + calloc/calloc_profile_scan/ut ) ENDIF() diff --git a/library/cpp/tvmauth/client/misc/threaded_updater.cpp b/library/cpp/tvmauth/client/misc/threaded_updater.cpp index 5d21ce67a7..d3b2b0fdac 100644 --- a/library/cpp/tvmauth/client/misc/threaded_updater.cpp +++ b/library/cpp/tvmauth/client/misc/threaded_updater.cpp @@ -10,15 +10,15 @@ namespace NTvmAuth { TThreadedUpdaterBase::TThreadedUpdaterBase(TDuration workerAwakingPeriod, TLoggerPtr logger, const TString& url, - ui16 port, - TDuration socketTimeout, - TDuration connectTimeout) + ui16 port, + TDuration socketTimeout, + TDuration connectTimeout) : WorkerAwakingPeriod_(workerAwakingPeriod) , Logger_(std::move(logger)) , TvmUrl_(url) , TvmPort_(port) - , TvmSocketTimeout_(socketTimeout) - , TvmConnectTimeout_(connectTimeout) + , TvmSocketTimeout_(socketTimeout) + , TvmConnectTimeout_(connectTimeout) , IsStopped_(true) { Y_ENSURE_EX(Logger_, TNonRetriableException() << "Logger is required"); @@ -55,7 +55,7 @@ namespace NTvmAuth { TKeepAliveHttpClient& TThreadedUpdaterBase::GetClient() const { if (!HttpClient_) { - HttpClient_ = MakeHolder<TKeepAliveHttpClient>(TvmUrl_, TvmPort_, TvmSocketTimeout_, TvmConnectTimeout_); + HttpClient_ = MakeHolder<TKeepAliveHttpClient>(TvmUrl_, TvmPort_, TvmSocketTimeout_, TvmConnectTimeout_); } return *HttpClient_; diff --git a/library/cpp/tvmauth/client/misc/threaded_updater.h b/library/cpp/tvmauth/client/misc/threaded_updater.h index 783684ba3b..218d8c7a1e 100644 --- a/library/cpp/tvmauth/client/misc/threaded_updater.h +++ b/library/cpp/tvmauth/client/misc/threaded_updater.h @@ -20,12 +20,12 @@ namespace NTvmAuth::NInternal { namespace NTvmAuth { class TThreadedUpdaterBase: public TAsyncUpdaterBase { public: - TThreadedUpdaterBase(TDuration workerAwakingPeriod, - TLoggerPtr logger, - const TString& url, - ui16 port, - TDuration socketTimeout, - TDuration connectTimeout); + TThreadedUpdaterBase(TDuration workerAwakingPeriod, + TLoggerPtr logger, + const TString& url, + ui16 port, + TDuration socketTimeout, + TDuration connectTimeout); virtual ~TThreadedUpdaterBase(); protected: @@ -65,8 +65,8 @@ namespace NTvmAuth { mutable THolder<TKeepAliveHttpClient> HttpClient_; const ui32 TvmPort_; - const TDuration TvmSocketTimeout_; - const TDuration TvmConnectTimeout_; + const TDuration TvmSocketTimeout_; + const TDuration TvmConnectTimeout_; mutable TAutoEvent Event_; mutable TAutoEvent Started_; diff --git a/library/cpp/tvmauth/client/misc/tool/settings.cpp b/library/cpp/tvmauth/client/misc/tool/settings.cpp index 894501f19d..c69798152b 100644 --- a/library/cpp/tvmauth/client/misc/tool/settings.cpp +++ b/library/cpp/tvmauth/client/misc/tool/settings.cpp @@ -9,8 +9,8 @@ namespace NTvmAuth::NTvmTool { : SelfAias_(selfAias) , Hostname_("localhost") , Port_(1) - , SocketTimeout_(TDuration::Seconds(5)) - , ConnectTimeout_(TDuration::Seconds(30)) + , SocketTimeout_(TDuration::Seconds(5)) + , ConnectTimeout_(TDuration::Seconds(30)) { AuthToken_ = GetEnv("TVMTOOL_LOCAL_AUTHTOKEN"); if (!AuthToken_) { diff --git a/library/cpp/tvmauth/client/misc/tool/settings.h b/library/cpp/tvmauth/client/misc/tool/settings.h index 63255ed090..d2c42d1c6b 100644 --- a/library/cpp/tvmauth/client/misc/tool/settings.h +++ b/library/cpp/tvmauth/client/misc/tool/settings.h @@ -6,7 +6,7 @@ #include <library/cpp/tvmauth/checked_user_ticket.h> -#include <util/datetime/base.h> +#include <util/datetime/base.h> #include <util/generic/maybe.h> namespace NTvmAuth::NTvmTool { @@ -53,16 +53,16 @@ namespace NTvmAuth::NTvmTool { return *this; } - TClientSettings& SetSocketTimeout(TDuration socketTimeout) { - SocketTimeout_ = socketTimeout; - return *this; - } - - TClientSettings& SetConnectTimeout(TDuration connectTimeout) { - ConnectTimeout_ = connectTimeout; - return *this; - } - + TClientSettings& SetSocketTimeout(TDuration socketTimeout) { + SocketTimeout_ = socketTimeout; + return *this; + } + + TClientSettings& SetConnectTimeout(TDuration connectTimeout) { + ConnectTimeout_ = connectTimeout; + return *this; + } + /*! * Look at comment for ctor * @param token @@ -103,14 +103,14 @@ namespace NTvmAuth::NTvmTool { return Port_; } - TDuration GetSocketTimeout() const { - return SocketTimeout_; - } - - TDuration GetConnectTimeout() const { - return ConnectTimeout_; - } - + TDuration GetSocketTimeout() const { + return SocketTimeout_; + } + + TDuration GetConnectTimeout() const { + return ConnectTimeout_; + } + const TString& GetAuthToken() const { Y_ENSURE_EX(AuthToken_, TBrokenTvmClientSettings() << "Auth token cannot be empty. " @@ -129,8 +129,8 @@ namespace NTvmAuth::NTvmTool { TAlias SelfAias_; TString Hostname_; ui16 Port_; - TDuration SocketTimeout_; - TDuration ConnectTimeout_; + TDuration SocketTimeout_; + TDuration ConnectTimeout_; TString AuthToken_; TMaybe<EBlackboxEnv> BbEnv_; }; diff --git a/library/cpp/tvmauth/client/misc/tool/threaded_updater.cpp b/library/cpp/tvmauth/client/misc/tool/threaded_updater.cpp index 8490f7ab54..66275df93c 100644 --- a/library/cpp/tvmauth/client/misc/tool/threaded_updater.cpp +++ b/library/cpp/tvmauth/client/misc/tool/threaded_updater.cpp @@ -61,7 +61,7 @@ namespace NTvmAuth::NTvmTool { return TClientStatus::Ok; } - TThreadedUpdater::TThreadedUpdater(const TString& host, ui16 port, TDuration socketTimeout, TDuration connectTimeout, TLoggerPtr logger) + TThreadedUpdater::TThreadedUpdater(const TString& host, ui16 port, TDuration socketTimeout, TDuration connectTimeout, TLoggerPtr logger) : TThreadedUpdaterBase(TDuration::Seconds(5), logger, host, port, socketTimeout, connectTimeout) , MetaInfo_(logger) , ConfigWarnDelay_(TDuration::Seconds(30)) diff --git a/library/cpp/tvmauth/client/misc/tool/threaded_updater.h b/library/cpp/tvmauth/client/misc/tool/threaded_updater.h index 7fe88adfae..fe686756d4 100644 --- a/library/cpp/tvmauth/client/misc/tool/threaded_updater.h +++ b/library/cpp/tvmauth/client/misc/tool/threaded_updater.h @@ -18,7 +18,7 @@ namespace NTvmAuth::NTvmTool { protected: // for tests TClientStatus::ECode GetState() const; - TThreadedUpdater(const TString& host, ui16 port, TDuration socketTimeout, TDuration connectTimeout, TLoggerPtr logger); + TThreadedUpdater(const TString& host, ui16 port, TDuration socketTimeout, TDuration connectTimeout, TLoggerPtr logger); void Init(const TClientSettings& settings); void UpdateState(); diff --git a/library/cpp/tvmauth/client/ut/tvmtool_updater_ut.cpp b/library/cpp/tvmauth/client/ut/tvmtool_updater_ut.cpp index 1295ed750e..a1c23c036f 100644 --- a/library/cpp/tvmauth/client/ut/tvmtool_updater_ut.cpp +++ b/library/cpp/tvmauth/client/ut/tvmtool_updater_ut.cpp @@ -310,7 +310,7 @@ Y_UNIT_TEST_SUITE(ToolUpdater) { class TNonInitedUpdater: public TThreadedUpdater { public: TNonInitedUpdater(const TString& host, ui16 port, TLoggerPtr logger) - : TThreadedUpdater(host, port, TDuration::Seconds(5), TDuration::Seconds(30), logger) + : TThreadedUpdater(host, port, TDuration::Seconds(5), TDuration::Seconds(30), logger) { } diff --git a/util/memory/pool.cpp b/util/memory/pool.cpp index 9a011f0e4f..58cbd22ed1 100644 --- a/util/memory/pool.cpp +++ b/util/memory/pool.cpp @@ -11,11 +11,11 @@ TMemoryPool::IGrowPolicy* TMemoryPool::TExpGrow::Instance() noexcept { void TMemoryPool::AddChunk(size_t hint) { const size_t dataLen = Max(BlockSize_, hint); - size_t allocSize = dataLen + sizeof(TChunk); - if (Options_.RoundUpToNextPowerOfTwo) { - allocSize = FastClp2(allocSize); - } - TBlock nb = Alloc_->Allocate(allocSize); + size_t allocSize = dataLen + sizeof(TChunk); + if (Options_.RoundUpToNextPowerOfTwo) { + allocSize = FastClp2(allocSize); + } + TBlock nb = Alloc_->Allocate(allocSize); // Add previous chunk's stats if (Current_ != &Empty_) { diff --git a/util/memory/pool.h b/util/memory/pool.h index 13c8b6b9ed..8f04e66969 100644 --- a/util/memory/pool.h +++ b/util/memory/pool.h @@ -123,20 +123,20 @@ public: static IGrowPolicy* Instance() noexcept; }; - struct TOptions { - bool RoundUpToNextPowerOfTwo; - TOptions() - : RoundUpToNextPowerOfTwo(true) - { - } - }; - - inline TMemoryPool(size_t initial, IGrowPolicy* grow = TExpGrow::Instance(), IAllocator* alloc = TDefaultAllocator::Instance(), const TOptions& options = TOptions()) + struct TOptions { + bool RoundUpToNextPowerOfTwo; + TOptions() + : RoundUpToNextPowerOfTwo(true) + { + } + }; + + inline TMemoryPool(size_t initial, IGrowPolicy* grow = TExpGrow::Instance(), IAllocator* alloc = TDefaultAllocator::Instance(), const TOptions& options = TOptions()) : Current_(&Empty_) , BlockSize_(initial) , GrowPolicy_(grow) , Alloc_(alloc) - , Options_(options) + , Options_(options) , Origin_(initial) , MemoryAllocatedBeforeCurrent_(0) , MemoryWasteBeforeCurrent_(0) @@ -299,7 +299,7 @@ private: size_t BlockSize_; IGrowPolicy* GrowPolicy_; IAllocator* Alloc_; - TOptions Options_; + TOptions Options_; TChunkList Chunks_; const size_t Origin_; size_t MemoryAllocatedBeforeCurrent_; diff --git a/util/memory/pool_ut.cpp b/util/memory/pool_ut.cpp index 1158a8ca42..2797058336 100644 --- a/util/memory/pool_ut.cpp +++ b/util/memory/pool_ut.cpp @@ -83,7 +83,7 @@ class TMemPoolTest: public TTestBase { UNIT_TEST(TestZeroArray) UNIT_TEST(TestLargeStartingAlign) UNIT_TEST(TestMoveAlloc) - UNIT_TEST(TestRoundUpToNextPowerOfTwoOption) + UNIT_TEST(TestRoundUpToNextPowerOfTwoOption) UNIT_TEST_SUITE_END(); private: @@ -239,47 +239,47 @@ private: CheckMoveAlloc<TNoCopy>(); CheckMoveAlloc<TErrorOnCopy>(); } - - void TestRoundUpToNextPowerOfTwoOption() { - const size_t MEMORY_POOL_BLOCK_SIZE = (1024 - 16) * 4096 - 16 - 16 - 32; - + + void TestRoundUpToNextPowerOfTwoOption() { + const size_t MEMORY_POOL_BLOCK_SIZE = (1024 - 16) * 4096 - 16 - 16 - 32; + class TFixedBlockSizeMemoryPoolPolicy final: public TMemoryPool::IGrowPolicy { - public: - size_t Next(size_t /*prev*/) const noexcept override { - return MEMORY_POOL_BLOCK_SIZE; - } - }; - TFixedBlockSizeMemoryPoolPolicy allocationPolicy; - + public: + size_t Next(size_t /*prev*/) const noexcept override { + return MEMORY_POOL_BLOCK_SIZE; + } + }; + TFixedBlockSizeMemoryPoolPolicy allocationPolicy; + class TTestAllocator final: public TDefaultAllocator { - public: - TBlock Allocate(size_t len) override { - Size_ += len; - return TDefaultAllocator::Allocate(len); - } - - size_t GetSize() const { - return Size_; - } - - private: - size_t Size_ = 0; - }; - - TTestAllocator allocator; - - TMemoryPool::TOptions options; - options.RoundUpToNextPowerOfTwo = false; - - constexpr size_t EXPECTED_ALLOCATION_SIZE = MEMORY_POOL_BLOCK_SIZE + 32; - TMemoryPool pool(MEMORY_POOL_BLOCK_SIZE, &allocationPolicy, &allocator, options); - - pool.Allocate(MEMORY_POOL_BLOCK_SIZE); - UNIT_ASSERT_VALUES_EQUAL(EXPECTED_ALLOCATION_SIZE, allocator.GetSize()); - - pool.Allocate(1); - UNIT_ASSERT_VALUES_EQUAL(2 * EXPECTED_ALLOCATION_SIZE, allocator.GetSize()); - } + public: + TBlock Allocate(size_t len) override { + Size_ += len; + return TDefaultAllocator::Allocate(len); + } + + size_t GetSize() const { + return Size_; + } + + private: + size_t Size_ = 0; + }; + + TTestAllocator allocator; + + TMemoryPool::TOptions options; + options.RoundUpToNextPowerOfTwo = false; + + constexpr size_t EXPECTED_ALLOCATION_SIZE = MEMORY_POOL_BLOCK_SIZE + 32; + TMemoryPool pool(MEMORY_POOL_BLOCK_SIZE, &allocationPolicy, &allocator, options); + + pool.Allocate(MEMORY_POOL_BLOCK_SIZE); + UNIT_ASSERT_VALUES_EQUAL(EXPECTED_ALLOCATION_SIZE, allocator.GetSize()); + + pool.Allocate(1); + UNIT_ASSERT_VALUES_EQUAL(2 * EXPECTED_ALLOCATION_SIZE, allocator.GetSize()); + } }; UNIT_TEST_SUITE_REGISTRATION(TMemPoolTest); diff --git a/util/system/thread.cpp b/util/system/thread.cpp index 6236746c2d..34bdb39384 100644 --- a/util/system/thread.cpp +++ b/util/system/thread.cpp @@ -207,7 +207,7 @@ namespace { TParams* holdP = P_.Release(); int err = pthread_create(&H_, pattrs, ThreadProxy, holdP); if (err) { - H_ = {}; + H_ = {}; P_.Reset(holdP); PCHECK(err, "failed to create thread"); } diff --git a/util/thread/lfqueue.h b/util/thread/lfqueue.h index ab523631e4..49c21dd0d7 100644 --- a/util/thread/lfqueue.h +++ b/util/thread/lfqueue.h @@ -77,7 +77,7 @@ class TLockFreeQueue: public TNonCopyable { void TryToFreeAsyncMemory() { TAtomic keepCounter = AtomicAdd(FreeingTaskCounter, 0); - TRootNode* current = AtomicGet(FreePtr); + TRootNode* current = AtomicGet(FreePtr); if (current == nullptr) return; if (AtomicAdd(FreememCounter, 0) == 1) { @@ -89,8 +89,8 @@ class TLockFreeQueue: public TNonCopyable { if (AtomicCas(&FreePtr, (TRootNode*)nullptr, current)) { // free list while (current) { - TRootNode* p = AtomicGet(current->NextFree); - EraseList(AtomicGet(current->ToDelete)); + TRootNode* p = AtomicGet(current->NextFree); + EraseList(AtomicGet(current->ToDelete)); delete current; current = p; } @@ -106,10 +106,10 @@ class TLockFreeQueue: public TNonCopyable { AtomicAdd(FreememCounter, -1); } void AsyncDel(TRootNode* toDelete, TListNode* lst) { - AtomicSet(toDelete->ToDelete, lst); + AtomicSet(toDelete->ToDelete, lst); for (;;) { - AtomicSet(toDelete->NextFree, AtomicGet(FreePtr)); - if (AtomicCas(&FreePtr, toDelete, AtomicGet(toDelete->NextFree))) + AtomicSet(toDelete->NextFree, AtomicGet(FreePtr)); + if (AtomicCas(&FreePtr, toDelete, AtomicGet(toDelete->NextFree))) break; } } @@ -174,11 +174,11 @@ class TLockFreeQueue: public TNonCopyable { void EnqueueImpl(TListNode* head, TListNode* tail) { TRootNode* newRoot = new TRootNode; AsyncRef(); - AtomicSet(newRoot->PushQueue, head); + AtomicSet(newRoot->PushQueue, head); for (;;) { - TRootNode* curRoot = AtomicGet(JobQueue); + TRootNode* curRoot = AtomicGet(JobQueue); AtomicSet(tail->Next, AtomicGet(curRoot->PushQueue)); - AtomicSet(newRoot->PopQueue, AtomicGet(curRoot->PopQueue)); + AtomicSet(newRoot->PopQueue, AtomicGet(curRoot->PopQueue)); newRoot->CopyCounter(curRoot); for (TListNode* node = head;; node = AtomicGet(node->Next)) { @@ -276,18 +276,18 @@ public: TListInvertor listInvertor; AsyncRef(); for (;;) { - TRootNode* curRoot = AtomicGet(JobQueue); - TListNode* tail = AtomicGet(curRoot->PopQueue); + TRootNode* curRoot = AtomicGet(JobQueue); + TListNode* tail = AtomicGet(curRoot->PopQueue); if (tail) { // has elems to pop if (!newRoot) newRoot = new TRootNode; - AtomicSet(newRoot->PushQueue, AtomicGet(curRoot->PushQueue)); + AtomicSet(newRoot->PushQueue, AtomicGet(curRoot->PushQueue)); AtomicSet(newRoot->PopQueue, AtomicGet(tail->Next)); newRoot->CopyCounter(curRoot); newRoot->DecCount(tail->Data); - Y_ASSERT(AtomicGet(curRoot->PopQueue) == tail); + Y_ASSERT(AtomicGet(curRoot->PopQueue) == tail); if (AtomicCas(&JobQueue, newRoot, curRoot)) { *data = std::move(tail->Data); AtomicSet(tail->Next, nullptr); @@ -296,7 +296,7 @@ public: } continue; } - if (AtomicGet(curRoot->PushQueue) == nullptr) { + if (AtomicGet(curRoot->PushQueue) == nullptr) { delete newRoot; AsyncUnref(); return false; // no elems to pop @@ -304,17 +304,17 @@ public: if (!newRoot) newRoot = new TRootNode; - AtomicSet(newRoot->PushQueue, nullptr); - listInvertor.DoCopy(AtomicGet(curRoot->PushQueue)); + AtomicSet(newRoot->PushQueue, nullptr); + listInvertor.DoCopy(AtomicGet(curRoot->PushQueue)); AtomicSet(newRoot->PopQueue, listInvertor.Copy); newRoot->CopyCounter(curRoot); - Y_ASSERT(AtomicGet(curRoot->PopQueue) == nullptr); + Y_ASSERT(AtomicGet(curRoot->PopQueue) == nullptr); if (AtomicCas(&JobQueue, newRoot, curRoot)) { newRoot = nullptr; listInvertor.CopyWasUsed(); - AsyncDel(curRoot, AtomicGet(curRoot->PushQueue)); + AsyncDel(curRoot, AtomicGet(curRoot->PushQueue)); } else { - AtomicSet(newRoot->PopQueue, nullptr); + AtomicSet(newRoot->PopQueue, nullptr); } } } @@ -345,14 +345,14 @@ public: } bool IsEmpty() { AsyncRef(); - TRootNode* curRoot = AtomicGet(JobQueue); - bool res = AtomicGet(curRoot->PushQueue) == nullptr && AtomicGet(curRoot->PopQueue) == nullptr; + TRootNode* curRoot = AtomicGet(JobQueue); + bool res = AtomicGet(curRoot->PushQueue) == nullptr && AtomicGet(curRoot->PopQueue) == nullptr; AsyncUnref(); return res; } TCounter GetCounter() { AsyncRef(); - TRootNode* curRoot = AtomicGet(JobQueue); + TRootNode* curRoot = AtomicGet(JobQueue); TCounter res = *(TCounter*)curRoot; AsyncUnref(); return res; |