diff options
| author | Randolph Tan <randolph@10gen.com> | 2019-06-27 15:41:10 -0400 |
|---|---|---|
| committer | Randolph Tan <randolph@10gen.com> | 2019-07-09 15:24:50 -0400 |
| commit | d15b1f2e036e262f8ea976e04780aa366fa20ad4 (patch) | |
| tree | a999cbb7f411c32855e6ce93f4588a7fd309ace7 /src/mongo/executor/scoped_task_executor.cpp | |
| parent | 209bbe879e84b4419295c8195bdbc2929c89e602 (diff) | |
| download | mongo-d15b1f2e036e262f8ea976e04780aa366fa20ad4.tar.gz | |
SERVER-40785 Change sharding fixed and arbitrary executors from unique_ptr to shared_ptr
Diffstat (limited to 'src/mongo/executor/scoped_task_executor.cpp')
| -rw-r--r-- | src/mongo/executor/scoped_task_executor.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/executor/scoped_task_executor.cpp b/src/mongo/executor/scoped_task_executor.cpp index e891d3c69a8..0f718242163 100644 --- a/src/mongo/executor/scoped_task_executor.cpp +++ b/src/mongo/executor/scoped_task_executor.cpp @@ -49,7 +49,7 @@ class ScopedTaskExecutor::Impl : public std::enable_shared_from_this<ScopedTaskE Status(ErrorCodes::ShutdownInProgress, "Shutting down ScopedTaskExecutor::Impl"); public: - explicit Impl(TaskExecutor* executor) : _executor(executor) {} + explicit Impl(std::shared_ptr<TaskExecutor> executor) : _executor(std::move(executor)) {} ~Impl() { // The ScopedTaskExecutor dtor calls shutdown, so this is guaranteed. @@ -304,7 +304,7 @@ private: stdx::mutex _mutex; bool _inShutdown = false; - TaskExecutor* const _executor; + std::shared_ptr<TaskExecutor> _executor; size_t _id = 0; stdx::unordered_map<size_t, CallbackHandle> _cbHandles; @@ -313,8 +313,8 @@ private: stdx::condition_variable _cv; }; -ScopedTaskExecutor::ScopedTaskExecutor(TaskExecutor* executor) - : _executor(std::make_shared<Impl>(executor)) {} +ScopedTaskExecutor::ScopedTaskExecutor(std::shared_ptr<TaskExecutor> executor) + : _executor(std::make_shared<Impl>(std::move(executor))) {} ScopedTaskExecutor::~ScopedTaskExecutor() { _executor->shutdown(); |
