diff options
Diffstat (limited to 'src/mongo/db/concurrency/d_concurrency_test.cpp')
-rw-r--r-- | src/mongo/db/concurrency/d_concurrency_test.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/concurrency/d_concurrency_test.cpp b/src/mongo/db/concurrency/d_concurrency_test.cpp index 37c59d08b41..9c1e131fdf6 100644 --- a/src/mongo/db/concurrency/d_concurrency_test.cpp +++ b/src/mongo/db/concurrency/d_concurrency_test.cpp @@ -69,19 +69,19 @@ const auto kMaxClockJitterMillis = Milliseconds(0); */ class UseGlobalThrottling { public: - explicit UseGlobalThrottling(OperationContext* opCtx, int numTickets) - : _opCtx(opCtx), _holder(numTickets) { - _opCtx->lockState()->setGlobalThrottling(&_holder, &_holder); + explicit UseGlobalThrottling(OperationContext* opCtx, int numTickets) : _opCtx(opCtx) { + _holder = std::make_unique<SemaphoreTicketHolder>(numTickets); + _opCtx->lockState()->setGlobalThrottling(_holder.get(), _holder.get()); } ~UseGlobalThrottling() noexcept(false) { // Reset the global setting as we're about to destroy the ticket holder. _opCtx->lockState()->setGlobalThrottling(nullptr, nullptr); - ASSERT_EQ(_holder.used(), 0); + ASSERT_EQ(_holder->used(), 0); } private: OperationContext* _opCtx; - TicketHolder _holder; + std::unique_ptr<TicketHolder> _holder; }; |