summaryrefslogtreecommitdiff
path: root/src/mongo/util/concurrency/ticketholder.h
diff options
context:
space:
mode:
authorJordi Olivares Provencio <jordi.olivares-provencio@mongodb.com>2022-09-05 12:11:47 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-05 12:39:49 +0000
commitfcdfe29cee066278b94ea2749456fc433cc398c6 (patch)
tree70a525f3983bc9743df85b37dd9dbf5aff724161 /src/mongo/util/concurrency/ticketholder.h
parente91cda950e50aa4c707efbdd0be208481493fc96 (diff)
downloadmongo-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.h15
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