MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / unload_all

Method unload_all

subprojects/llama.cpp/tools/server/server-models.cpp:617–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

615}
616
617void server_models::unload_all() {
618 std::vector<std::thread> to_join;
619 {
620 std::lock_guard<std::mutex> lk(mutex);
621 for (auto & [name, inst] : mapping) {
622 if (inst.meta.is_active()) {
623 SRV_INF("unloading model instance name=%s\n", name.c_str());
624 stopping_models.insert(name);
625 cv_stop.notify_all();
626 // status change will be handled by the managing thread
627 }
628 // moving the thread to join list to avoid deadlock
629 to_join.push_back(std::move(inst.th));
630 }
631 }
632 for (auto & th : to_join) {
633 if (th.joinable()) {
634 th.join();
635 }
636 }
637}
638
639void server_models::update_status(const std::string & name, server_model_status status, int exit_code) {
640 std::unique_lock<std::mutex> lk(mutex);

Callers 1

mainFunction · 0.80

Calls 4

is_activeMethod · 0.80
insertMethod · 0.45
push_backMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected