diff options
| author | vskipin <[email protected]> | 2022-02-10 16:46:00 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:00 +0300 |
| commit | 4e4b78bd7b67e2533da4dbb9696374a6d6068e32 (patch) | |
| tree | a7a5543d815c451256ece74081d960b4e1d70ec2 /library/cpp/messagebus/actor | |
| parent | 5b00ed04a5137a452fa6d3423cb0c9b54ac27408 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/actor')
| -rw-r--r-- | library/cpp/messagebus/actor/executor.cpp | 8 | ||||
| -rw-r--r-- | library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h | 20 |
2 files changed, 14 insertions, 14 deletions
diff --git a/library/cpp/messagebus/actor/executor.cpp b/library/cpp/messagebus/actor/executor.cpp index 7a2227a4589..d0ed3647fa4 100644 --- a/library/cpp/messagebus/actor/executor.cpp +++ b/library/cpp/messagebus/actor/executor.cpp @@ -176,7 +176,7 @@ TExecutor::TExecutor(const TExecutor::TConfig& config) void TExecutor::Init() { Impl.Reset(new TImpl(this)); - AtomicSet(ExitWorkers, 0); + AtomicSet(ExitWorkers, 0); Y_VERIFY(Config.WorkerCount > 0); @@ -192,7 +192,7 @@ TExecutor::~TExecutor() { } void TExecutor::Stop() { - AtomicSet(ExitWorkers, 1); + AtomicSet(ExitWorkers, 1); Impl->HelperStopSignal.Signal(); Impl->HelperThread.Join(); @@ -214,7 +214,7 @@ void TExecutor::EnqueueWork(TArrayRef<IWorkItem* const> wis) { if (wis.empty()) return; - if (Y_UNLIKELY(AtomicGet(ExitWorkers) != 0)) { + if (Y_UNLIKELY(AtomicGet(ExitWorkers) != 0)) { Y_VERIFY(WorkItems.Empty(), "executor %s: cannot add tasks after queue shutdown", Config.Name); } @@ -289,7 +289,7 @@ TAutoPtr<IWorkItem> TExecutor::DequeueWork() { if (!WorkItems.TryPop(&wi, &queueSize)) { TWhatThreadDoesAcquireGuard<TMutex> g(WorkMutex, "executor: acquiring lock for DequeueWork"); while (!WorkItems.TryPop(&wi, &queueSize)) { - if (AtomicGet(ExitWorkers) != 0) + if (AtomicGet(ExitWorkers) != 0) return nullptr; TWhatThreadDoesPushPop pp("waiting for work on condvar"); diff --git a/library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h b/library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h index f0b7cd90e40..b49bfd6cfb1 100644 --- a/library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h +++ b/library/cpp/messagebus/actor/ring_buffer_with_spin_lock.h @@ -9,11 +9,11 @@ class TRingBufferWithSpinLock { private: TRingBuffer<T> RingBuffer; TSpinLock SpinLock; - TAtomic CachedSize; - + TAtomic CachedSize; + public: TRingBufferWithSpinLock() - : CachedSize(0) + : CachedSize(0) { } @@ -28,11 +28,11 @@ public: TGuard<TSpinLock> Guard(SpinLock); RingBuffer.PushAll(collection); - AtomicSet(CachedSize, RingBuffer.Size()); + AtomicSet(CachedSize, RingBuffer.Size()); } bool TryPop(T* r, size_t* sizePtr = nullptr) { - if (AtomicGet(CachedSize) == 0) { + if (AtomicGet(CachedSize) == 0) { return false; } @@ -42,7 +42,7 @@ public: TGuard<TSpinLock> Guard(SpinLock); ok = RingBuffer.TryPop(r); size = RingBuffer.Size(); - AtomicSet(CachedSize, size); + AtomicSet(CachedSize, size); } if (!!sizePtr) { *sizePtr = size; @@ -63,25 +63,25 @@ public: if (collection.size() == 0) { return TryPop(r); } else { - if (AtomicGet(CachedSize) == 0) { + if (AtomicGet(CachedSize) == 0) { *r = collection[0]; if (collection.size() > 1) { TGuard<TSpinLock> guard(SpinLock); RingBuffer.PushAll(MakeArrayRef(collection.data() + 1, collection.size() - 1)); - AtomicSet(CachedSize, RingBuffer.Size()); + AtomicSet(CachedSize, RingBuffer.Size()); } } else { TGuard<TSpinLock> guard(SpinLock); RingBuffer.PushAll(collection); *r = RingBuffer.Pop(); - AtomicSet(CachedSize, RingBuffer.Size()); + AtomicSet(CachedSize, RingBuffer.Size()); } return true; } } bool Empty() const { - return AtomicGet(CachedSize) == 0; + return AtomicGet(CachedSize) == 0; } size_t Size() const { |
