MCPcopy Index your code
hub / github.com/RustCV/RustCV / get_runtime

Function get_runtime

rustcv/src/internal/runtime.rs:9–18  ·  view source on GitHub ↗

获取全局 Runtime,如果不存在则创建 这允许用户不写 #[tokio::main] 也能跑异步驱动

()

Source from the content-addressed store, hash-verified

7/// 获取全局 Runtime,如果不存在则创建
8/// 这允许用户不写 #[tokio::main] 也能跑异步驱动
9pub fn get_runtime() -> &'static Runtime {
10 RUNTIME.get_or_init(|| {
11 tokio::runtime::Builder::new_multi_thread()
12 .enable_all()
13 .worker_threads(2) // 这里的 IO 任务不繁重,2个线程足矣
14 .thread_name("rustcv-bg-worker")
15 .build()
16 .expect("Failed to create RustCV background runtime")
17 })
18}
19
20/// 辅助函数:在后台运行 Future 并阻塞等待结果
21#[allow(dead_code)]

Callers 2

newMethod · 0.85
block_onFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected