aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2018-10-15 13:11:55 -0700
committerGravatar Mark D. Roth <roth@google.com>2018-10-15 13:11:55 -0700
commit0b085a1f05813f54d4164c95fe9431c11f416af3 (patch)
treea2fc87d3fc5075984a37d70ca863c950ea568ca8 /src/cpp
parent4d9ad11653f76787c9af76c62ae18f7c7ea53c3d (diff)
Fix tsan problem at startup.
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/server/health/default_health_check_service.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc
index e86c05c4b0..4c60531090 100644
--- a/src/cpp/server/health/default_health_check_service.cc
+++ b/src/cpp/server/health/default_health_check_service.cc
@@ -153,16 +153,18 @@ DefaultHealthCheckService::HealthCheckServiceImpl::~HealthCheckServiceImpl() {
}
void DefaultHealthCheckService::HealthCheckServiceImpl::StartServingThread() {
+ // Request the calls we're interested in.
+ // We do this before starting the serving thread, so that we know it's
+ // done before server startup is complete.
+ CheckCallHandler::CreateAndStart(cq_.get(), database_, this);
+ WatchCallHandler::CreateAndStart(cq_.get(), database_, this);
+ // Start serving thread.
thread_->Start();
}
void DefaultHealthCheckService::HealthCheckServiceImpl::Serve(void* arg) {
HealthCheckServiceImpl* service =
reinterpret_cast<HealthCheckServiceImpl*>(arg);
- CheckCallHandler::CreateAndStart(service->cq_.get(), service->database_,
- service);
- WatchCallHandler::CreateAndStart(service->cq_.get(), service->database_,
- service);
void* tag;
bool ok;
while (true) {