MCPcopy Create free account
hub / github.com/actor-framework/actor-framework / stop

Method stop

libcaf_io/caf/io/middleman.cpp:366–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366void middleman::stop() {
367 auto lg = log::io::trace("");
368 backend().dispatch([this] {
369 auto lg = log::io::trace("");
370 // managers_ will be modified while we are stopping each manager,
371 // because each manager will call remove(...)
372 for (auto& kvp : named_brokers_) {
373 auto& hdl = kvp.second;
374 auto ptr = actor_cast<broker*>(hdl);
375 if (!ptr->getf(abstract_actor::is_terminated_flag)) {
376 ptr->context(&backend());
377 ptr->quit();
378 ptr->finalize();
379 }
380 }
381 });
382 backend_supervisor_.reset();
383 if (thread_.joinable())
384 thread_.join();
385 named_brokers_.clear();
386 scoped_actor self{system(), true};
387 self->send_exit(manager_, exit_reason::kill);
388 if (!get_or(config(), "caf.middleman.attach-utility-actors", false))
389 self->wait_for(manager_);
390 destroy(manager_);
391 background_tasks_.clear();
392}
393
394void middleman::init(actor_system_config& cfg) {
395 // Compute and set ID for this network node.

Callers

nothing calls this directly

Calls 11

traceFunction · 0.85
dispatchMethod · 0.80
finalizeMethod · 0.80
get_orFunction · 0.50
configClass · 0.50
destroyFunction · 0.50
contextMethod · 0.45
quitMethod · 0.45
resetMethod · 0.45
clearMethod · 0.45
send_exitMethod · 0.45

Tested by

no test coverage detected