diff options
author | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-05-16 14:19:22 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@yahooinc.com> | 2022-05-16 14:19:22 +0000 |
commit | 1649af608189b0b920afb649ff012a00ecdc9f9a (patch) | |
tree | 547cdb9a554b41696c580f1dba5abfb294bce177 | |
parent | fc840324a48ff30150c7891bc4798d262359ac70 (diff) |
Ensure stripe pool threads vector is fully visible to all started stripes
-rw-r--r-- | storage/src/vespa/storage/distributor/distributor_stripe_pool.cpp | 1 | ||||
-rw-r--r-- | storage/src/vespa/storage/distributor/distributor_stripe_thread.cpp | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_pool.cpp b/storage/src/vespa/storage/distributor/distributor_stripe_pool.cpp index 8b172743d27..30d13e4eb1a 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe_pool.cpp +++ b/storage/src/vespa/storage/distributor/distributor_stripe_pool.cpp @@ -117,6 +117,7 @@ void DistributorStripePool::start(const std::vector<TickableStripe*>& stripes) { if (_single_threaded_test_mode) { return; // We want all the control structures in place, but none of the actual OS threads. } + std::unique_lock lock(_mutex); // Ensure _threads is visible to all started threads for (auto& s : _stripes) { _threads.emplace_back(_thread_pool.NewThread(s.get())); } diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_thread.cpp b/storage/src/vespa/storage/distributor/distributor_stripe_thread.cpp index ae5445da620..8f37dbbbf5d 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe_thread.cpp +++ b/storage/src/vespa/storage/distributor/distributor_stripe_thread.cpp @@ -47,7 +47,7 @@ void DistributorStripeThread::signal_wants_park() noexcept { assert(!should_park_relaxed()); _should_park.store(true, std::memory_order_relaxed); if (_waiting_for_event) { - _event_cond.notify_one(); // TODO after unlock? + _event_cond.notify_one(); } } @@ -55,7 +55,7 @@ void DistributorStripeThread::unpark_thread() noexcept { std::lock_guard lock(_mutex); assert(should_park_relaxed()); _should_park.store(false, std::memory_order_relaxed); - _park_cond.notify_one(); // TODO after unlock? + _park_cond.notify_one(); } void DistributorStripeThread::wait_until_event_notified_or_timed_out() noexcept { |