diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2017-08-23 22:17:57 -0400 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2017-08-28 18:55:16 -0400 |
commit | c246ae62641c3559c38830f6f5f4981e0acffa0c (patch) | |
tree | 02606ad94456d5a63fb8f5294305c042450ad82d /src/mongo/db/repl/scatter_gather_runner.h | |
parent | 2203abc793e888e1c7b281b8bf213e0fd0446795 (diff) | |
download | mongo-c246ae62641c3559c38830f6f5f4981e0acffa0c.tar.gz |
SERVER-29386 VoteRequestor and FreshnessChecker need safe destruction
Diffstat (limited to 'src/mongo/db/repl/scatter_gather_runner.h')
-rw-r--r-- | src/mongo/db/repl/scatter_gather_runner.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/db/repl/scatter_gather_runner.h b/src/mongo/db/repl/scatter_gather_runner.h index 4a58461de1e..ce12c99b1a8 100644 --- a/src/mongo/db/repl/scatter_gather_runner.h +++ b/src/mongo/db/repl/scatter_gather_runner.h @@ -54,9 +54,10 @@ public: /** * Constructs a new runner whose underlying algorithm is "algorithm". * - * "algorithm" and "executor" must remain in scope until the runner's destructor completes. + * "executor" must remain in scope until the runner's destructor completes. + * "algorithm" is shared between the runner and the caller. */ - explicit ScatterGatherRunner(ScatterGatherAlgorithm* algorithm, + explicit ScatterGatherRunner(std::shared_ptr<ScatterGatherAlgorithm> algorithm, executor::TaskExecutor* executor); /** @@ -92,7 +93,8 @@ private: */ class RunnerImpl { public: - explicit RunnerImpl(ScatterGatherAlgorithm* algorithm, executor::TaskExecutor* executor); + explicit RunnerImpl(std::shared_ptr<ScatterGatherAlgorithm> algorithm, + executor::TaskExecutor* executor); /** * On success, returns an event handle that will be signaled when the runner has @@ -121,8 +123,8 @@ private: */ void _signalSufficientResponsesReceived(); - executor::TaskExecutor* _executor; // Not owned here. - ScatterGatherAlgorithm* _algorithm; // Not owned here. + executor::TaskExecutor* _executor; // Not owned here. + std::shared_ptr<ScatterGatherAlgorithm> _algorithm; executor::TaskExecutor::EventHandle _sufficientResponsesReceived; std::vector<executor::TaskExecutor::CallbackHandle> _callbacks; bool _started = false; |