上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 111 下一页
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/signal/index.html Tokio 可以异步接收系统传递的信号。 示例 main.rs 按下 ctrl-c 时,程序结 阅读全文
posted @ 2022-03-30 09:14 jiangbo4444 阅读(162) 评论(0) 推荐(0)
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/attr.main.html 除了使用明确编写代码来新建运行时,也可以使用宏来创建。 示例 main.rs use std::{i 阅读全文
posted @ 2022-03-30 09:13 jiangbo4444 阅读(251) 评论(0) 推荐(0)
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/task/index.html yield_now 可以放弃当前的执行时间片。 示例 main.rs use std::{io, 阅读全文
posted @ 2022-03-30 09:12 jiangbo4444 阅读(142) 评论(0) 推荐(0)
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html 默认情况下,Tokio 启动的工作线程数和 CPU 核数相等,也可以自定义 阅读全文
posted @ 2022-02-28 19:31 jiangbo4444 阅读(1224) 评论(0) 推荐(0)
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html 除了使用 new 直接创建的方式,还可以使用 Builder 来构建运行时 阅读全文
posted @ 2022-02-28 19:31 jiangbo4444 阅读(109) 评论(0) 推荐(0)
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html 在线程空闲和运行时,可以定义一个回调。 示例 main.rs use st 阅读全文
posted @ 2022-02-28 19:30 jiangbo4444 阅读(112) 评论(0) 推荐(0)
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html 通过 thread_name 和 thread_name_fn 可以对线程 阅读全文
posted @ 2022-02-28 19:30 jiangbo4444 阅读(284) 评论(0) 推荐(0)
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html 对于阻塞任务,Tokio 会新启动一个线程来运行,可以设置启动的最大线程数 阅读全文
posted @ 2022-02-28 19:29 jiangbo4444 阅读(450) 评论(0) 推荐(0)
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html 对于阻塞任务,Tokio 会新启动一个线程来运行,这个也是在一个线程池中, 阅读全文
posted @ 2022-02-28 19:29 jiangbo4444 阅读(114) 评论(0) 推荐(0)
摘要: 环境 Time 2022-01-11 Rust 1.57.0 Tokio 1.15.0 概念 参考:https://docs.rs/tokio/latest/tokio/runtime/struct.Builder.html 在线程启动和结束时,可以定义一个回调。 示例 main.rs use st 阅读全文
posted @ 2022-02-28 19:28 jiangbo4444 阅读(123) 评论(0) 推荐(0)
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 111 下一页