summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_context.cpp
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2019-01-02 16:48:56 -0500
committerLouis Williams <louis.williams@mongodb.com>2019-01-17 11:35:32 -0500
commite12dcc7fdbdb44fb7806dfb42a49bd740f361d82 (patch)
treed23cdd47b52a10b5100598a8f6464febf8ec9b80 /src/mongo/db/service_context.cpp
parent7edc50cf214893688eb8432619e4a8bba18d107b (diff)
downloadmongo-e12dcc7fdbdb44fb7806dfb42a49bd740f361d82.tar.gz
SERVER-37270 Remove foreground index builds by default
Diffstat (limited to 'src/mongo/db/service_context.cpp')
-rw-r--r--src/mongo/db/service_context.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp
index da1040ca6d8..f0b2dbbf44a 100644
--- a/src/mongo/db/service_context.cpp
+++ b/src/mongo/db/service_context.cpp
@@ -225,6 +225,9 @@ void ServiceContext::ClientDeleter::operator()(Client* client) const {
{
stdx::lock_guard<stdx::mutex> lk(service->_mutex);
invariant(service->_clients.erase(client));
+ if (service->_clients.empty()) {
+ service->_clientsEmptyCondVar.notify_all();
+ }
}
onDestroy(client, service->_clientObservers);
delete client;
@@ -342,6 +345,14 @@ void ServiceContext::waitForStartupComplete() {
_startupCompleteCondVar.wait(lk, [this] { return _startupComplete; });
}
+void ServiceContext::waitForClientsToFinish() {
+ stdx::unique_lock<stdx::mutex> lk(_mutex);
+ for (const auto& client : _clients) {
+ log() << "Waiting for client " << client->desc() << " to exit";
+ }
+ _clientsEmptyCondVar.wait(lk, [this] { return _clients.empty(); });
+}
+
void ServiceContext::notifyStartupComplete() {
stdx::unique_lock<stdx::mutex> lk(_mutex);
_startupComplete = true;