From 539cbf003ec8bfa15d9511baf141cd78815c5d48 Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Mon, 24 Nov 2025 14:21:21 +0100 Subject: [PATCH] add stdin_file --- tools/server/server-models.cpp | 15 ++++++++------- tools/server/server-models.h | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/server/server-models.cpp b/tools/server/server-models.cpp index cb19d2c341..a196911507 100644 --- a/tools/server/server-models.cpp +++ b/tools/server/server-models.cpp @@ -407,6 +407,8 @@ void server_models::load(const std::string & name, const std::vectorsecond.meta.is_active()) { SRV_INF("unloading model instance name=%s\n", name.c_str()); - interrupt_subprocess(it->second.subproc.get()); + interrupt_subprocess(it->second.stdin_file); // status change will be handled by the managing thread } else { SRV_WRN("model instance name=%s is not loaded\n", name.c_str()); @@ -488,7 +489,7 @@ void server_models::unload_all() { for (auto & [name, inst] : mapping) { if (inst.meta.is_active()) { SRV_INF("unloading model instance name=%s\n", name.c_str()); - interrupt_subprocess(inst.subproc.get()); + interrupt_subprocess(inst.stdin_file); // status change will be handled by the managing thread } // moving the thread to join list to avoid deadlock diff --git a/tools/server/server-models.h b/tools/server/server-models.h index c49cb7c62c..68a8ac302e 100644 --- a/tools/server/server-models.h +++ b/tools/server/server-models.h @@ -74,6 +74,7 @@ private: std::shared_ptr subproc; // shared between main thread and monitoring thread std::thread th; server_model_meta meta; + FILE * stdin_file = nullptr; }; std::mutex mutex;