summaryrefslogtreecommitdiff
path: root/src/mongo/transport/service_executor_synchronous.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/transport/service_executor_synchronous.cpp')
-rw-r--r--src/mongo/transport/service_executor_synchronous.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/transport/service_executor_synchronous.cpp b/src/mongo/transport/service_executor_synchronous.cpp
index 10cc0ad3cce..d58a917841e 100644
--- a/src/mongo/transport/service_executor_synchronous.cpp
+++ b/src/mongo/transport/service_executor_synchronous.cpp
@@ -78,6 +78,17 @@ Status ServiceExecutorSynchronous::shutdown(Milliseconds timeout) {
"passthrough executor couldn't shutdown all worker threads within time limit.");
}
+const auto getServiceExecutorSynchronous =
+ ServiceContext::declareDecoration<std::unique_ptr<ServiceExecutorSynchronous>>();
+
+ServiceExecutorSynchronous* ServiceExecutorSynchronous::get(ServiceContext* ctx) {
+ auto& ref = getServiceExecutorSynchronous(ctx);
+ if (!ref) {
+ ref = std::make_unique<ServiceExecutorSynchronous>();
+ }
+ return ref.get();
+}
+
Status ServiceExecutorSynchronous::schedule(Task task, ScheduleFlags flags) {
if (!_stillRunning.load()) {
return Status{ErrorCodes::ShutdownInProgress, "Executor is not running"};