Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions source/common/thread_local/thread_local_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ void InstanceImpl::runOnAllThreads(Event::PostCb cb, Event::PostCb all_threads_c
// all_threads_complete_cb method. Parallelism of main thread execution is being traded off
// for programming simplicity here.
cb();
std::shared_ptr<std::atomic<uint64_t>> worker_count =
std::make_shared<std::atomic<uint64_t>>(registered_threads_.size());
for (Event::Dispatcher& dispatcher : registered_threads_) {
dispatcher.post([this, worker_count, cb, all_threads_complete_cb]() -> void {
cb();
if (--*worker_count == 0) {

std::shared_ptr<Event::PostCb> shared_function(
Comment thread
lambdai marked this conversation as resolved.
Outdated
new Event::PostCb(cb), [this, all_threads_complete_cb](Event::PostCb* cb) {
main_thread_dispatcher_->post(all_threads_complete_cb);
}
});
delete cb;
});

for (Event::Dispatcher& dispatcher : registered_threads_) {
dispatcher.post([cb_guard = shared_function]() -> void { cb_guard->operator()(); });
Comment thread
lambdai marked this conversation as resolved.
Outdated
}
}

Expand Down