forked from 1b-agent/opencadstudio-upstream
Fix 3: optimize shutdown times
This commit is contained in:
1 parent
8eb199bfc7
commit
a93d425002
4 files changed
+128
-21
No files matched your search
+10
-1
@@ -221,7 +221,7 @@ fn parse_string_array(s: &str) -> Vec<String> {
|
||||
// ── Runtime loading (desktop only) ──────────────────────────────────────────
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(crate) use loader::with_manager;
|
||||
pub(crate) use loader::{shutdown_plugins, with_manager};
|
||||
|
||||
#[cfg(all(not(target_arch = "wasm32"), not(test)))]
|
||||
pub(crate) use loader::{load_at_startup, loaded_ids};
|
||||
@@ -285,6 +285,15 @@ mod loader {
|
||||
})
|
||||
}
|
||||
|
||||
/// Eagerly shut down all plugin runner processes.
|
||||
pub fn shutdown_plugins() {
|
||||
MANAGER.with(|m| {
|
||||
if let Some(mut manager) = m.borrow_mut().take() {
|
||||
manager.shutdown_all();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Path to the native library beside `plugin.toml`, if any.
|
||||
fn lib_file(dir: &Path) -> Option<PathBuf> {
|
||||
let ext = lib_extension();
|
||||
|
||||
Reference in new issue
Block a user