view_builder: Add comment about builder instances life-times

The barrier passing is tricky and deserves a description
about objects' life-times.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2020-08-26 15:23:19 +03:00
parent 643c431ce4
commit cf1cb4d145

View File

@@ -1266,6 +1266,10 @@ future<> view_builder::start(service::migration_manager& mm) {
}
return container().invoke_on(0, [eptr = std::move(eptr)] (view_builder& builder) {
// The &builder is alive, because it can only be destroyed in
// sharded<view_builder>::stop(), which, in turn, waits for all
// view_builder::stop()-s to finish, and each stop() waits for
// the shard's current future (called _started) to resolve.
if (!eptr) {
if (++builder._shards_finished_read == smp::count) {
builder._shards_finished_read_promise.set_value();