diff options
Diffstat (limited to 'src/mongo/db/repl/abstract_async_component.h')
-rw-r--r-- | src/mongo/db/repl/abstract_async_component.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mongo/db/repl/abstract_async_component.h b/src/mongo/db/repl/abstract_async_component.h index 5b0e6426900..084d21b9328 100644 --- a/src/mongo/db/repl/abstract_async_component.h +++ b/src/mongo/db/repl/abstract_async_component.h @@ -58,7 +58,7 @@ class AbstractAsyncComponent { public: AbstractAsyncComponent(executor::TaskExecutor* executor, const std::string& componentName); - virtual ~AbstractAsyncComponent() = default; + virtual ~AbstractAsyncComponent(); /** * Returns true if this component is currently running or in the process of shutting down. @@ -85,6 +85,11 @@ public: void join() noexcept; /** + * Returns a future that will complete when the component becomes inactive. + */ + SemiFuture<void> joinAsync() noexcept; + + /** * State transitions: * PreStart --> Running --> ShuttingDown --> Complete * It is possible to skip intermediate states. For example, calling shutdown() when the @@ -216,6 +221,8 @@ private: // (R) Read-only in concurrent operation; no synchronization required. // (S) Self-synchronizing; access in any way from any context. // (M) Reads and writes guarded by mutex returned by _getMutex(). + // (W) May read and call const methods without synchronization, + // must hold mutex to write and call non-const methods. // Task executor used to schedule tasks and remote commands. executor::TaskExecutor* const _executor; // (R) @@ -228,7 +235,7 @@ private: State _state = State::kPreStart; // (M) // Used by _transitionToComplete_inlock() to signal changes in '_state'. - mutable stdx::condition_variable _stateCondition; // (S) + mutable SharedPromise<void> _statePromise; // (W) }; /** |