diff options
author | Jordi Olivares Provencio <jordi.olivares-provencio@mongodb.com> | 2022-09-05 12:11:47 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-05 12:39:49 +0000 |
commit | fcdfe29cee066278b94ea2749456fc433cc398c6 (patch) | |
tree | 70a525f3983bc9743df85b37dd9dbf5aff724161 /src/mongo/util/concurrency/ticketholder.h | |
parent | e91cda950e50aa4c707efbdd0be208481493fc96 (diff) | |
download | mongo-fcdfe29cee066278b94ea2749456fc433cc398c6.tar.gz |
SERVER-68793 Refactor TicketHolder::resize() in all implementations
Diffstat (limited to 'src/mongo/util/concurrency/ticketholder.h')
-rw-r--r-- | src/mongo/util/concurrency/ticketholder.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mongo/util/concurrency/ticketholder.h b/src/mongo/util/concurrency/ticketholder.h index eedaa1bb8bc..34540b4543b 100644 --- a/src/mongo/util/concurrency/ticketholder.h +++ b/src/mongo/util/concurrency/ticketholder.h @@ -138,7 +138,7 @@ public: Date_t until, TicketHolder::WaitMode waitMode) override; - Status resize(int newSize); + void resize(int newSize) noexcept; virtual int available() const = 0; @@ -172,6 +172,8 @@ private: virtual void _releaseQueue(AdmissionContext* admCtx) noexcept = 0; + virtual void _resize(int newSize, int oldSize) noexcept = 0; + AtomicWord<std::int64_t> _totalAddedQueue{0}; AtomicWord<std::int64_t> _totalRemovedQueue{0}; AtomicWord<std::int64_t> _totalFinishedProcessing{0}; @@ -229,8 +231,8 @@ public: void appendStats(BSONObjBuilder& b) const override final; - Status resizeReaders(int newSize); - Status resizeWriters(int newSize); + void resizeReaders(int newSize); + void resizeWriters(int newSize); private: void _release(AdmissionContext* admCtx) noexcept override final; @@ -258,6 +260,8 @@ private: void _appendImplStats(BSONObjBuilder& b) const override final; + void _resize(int newSize, int oldSize) noexcept override final; + #if defined(__linux__) mutable sem_t _sem; @@ -300,6 +304,10 @@ private: void _releaseQueue(AdmissionContext* admCtx) noexcept override final; + void _dequeueWaiter(WithLock queueLock); + + void _resize(int newSize, int oldSize) noexcept override final; + // Implementation statistics. AtomicWord<std::int64_t> _totalTimeQueuedMicros{0}; @@ -384,6 +392,7 @@ private: void _appendImplStats(BSONObjBuilder& b) const override final{}; + void _resize(int newSize, int oldSize) noexcept override final; /** * Wakes up a waiting thread (if it exists) in order for it to attempt to obtain a ticket. * Implementors MUST wake at least one waiting thread if at least one thread is pending to be |