diff options
author | robot-dts-analyst <robot-dts-analyst@yandex-team.com> | 2022-09-19 08:51:10 +0300 |
---|---|---|
committer | robot-dts-analyst <robot-dts-analyst@yandex-team.com> | 2022-09-19 08:51:10 +0300 |
commit | 1c6db88c11405145297950dcc139a992c560c362 (patch) | |
tree | aad91d10687fc5ae409ff87b2794b953245abb0c /library/cpp | |
parent | c38426f392c5dd64ecd466d34bfd73a2a3cbce7a (diff) | |
download | ydb-1c6db88c11405145297950dcc139a992c560c362.tar.gz |
Rebalancing autocheck partitions and distbuild clusters.
The process of preparing changes https://sandbox.yandex-team.ru/task/1452983473/view
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/yt/memory/atomic_intrusive_ptr-inl.h | 2 | ||||
-rw-r--r-- | library/cpp/yt/memory/atomic_intrusive_ptr.h | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/library/cpp/yt/memory/atomic_intrusive_ptr-inl.h b/library/cpp/yt/memory/atomic_intrusive_ptr-inl.h index e2a6fd41fd8..ca2467a2803 100644 --- a/library/cpp/yt/memory/atomic_intrusive_ptr-inl.h +++ b/library/cpp/yt/memory/atomic_intrusive_ptr-inl.h @@ -48,7 +48,7 @@ TAtomicIntrusivePtr<T>& TAtomicIntrusivePtr<T>::operator=(std::nullptr_t) } template <class T> -TIntrusivePtr<T> TAtomicIntrusivePtr<T>::Acquire() +TIntrusivePtr<T> TAtomicIntrusivePtr<T>::Acquire() const { char* ptr = Ptr_.load(); while (true) { diff --git a/library/cpp/yt/memory/atomic_intrusive_ptr.h b/library/cpp/yt/memory/atomic_intrusive_ptr.h index c487330352d..bbcfc25e953 100644 --- a/library/cpp/yt/memory/atomic_intrusive_ptr.h +++ b/library/cpp/yt/memory/atomic_intrusive_ptr.h @@ -28,7 +28,7 @@ public: TAtomicIntrusivePtr& operator=(TIntrusivePtr<T> other); TAtomicIntrusivePtr& operator=(std::nullptr_t); - TIntrusivePtr<T> Acquire(); + TIntrusivePtr<T> Acquire() const; TIntrusivePtr<T> Exchange(TIntrusivePtr<T> other); @@ -58,7 +58,8 @@ private: // Atomic ptr holds N references, where N = ReservedRefCount - localRefCount. // LocalRefCount is incremented in Acquire method. // When localRefCount exceeds ReservedRefCount / 2 a new portion of refs are required globally. - std::atomic<char*> Ptr_ = nullptr; + // This field is marked mutable in order to make Acquire const-qualified in accordance to its semantics. + mutable std::atomic<char*> Ptr_ = nullptr; constexpr static int CounterBits = 64 - PtrBits; constexpr static int ReservedRefCount = (1 << CounterBits) - 1; |