23:05:36
icon
Web site image
はてラボ(アイコン) スタンダードTシャツ
22:41:21
icon

use std::thread;
use tokio::task::LocalSet;
use tokio::runtime::Builder;

fn main() {
    thread::spawn(move || {
        let local = LocalSet::new();
        let rt = Builder::new_current_thread()
            .enable_all()
            .build()
            .unwrap();
        rt.block_on(local.run_until(async {
            let task = tokio::task::spawn_local(async {
                //何かしらの処理
            });
            let _ = task.await;
        }));
    });
}
fn main() {
    thread::spawn(move || {
        let local = tokio::task::LocalSet::new();
        local.spawn_local(async move {
           // 何かしらの処理
        });
        tokio::runtime::Builder::new_current_thread()
            .enable_all()
            .build()
            .unwrap()
            .block_on(local);
    });
}
の、threadの観点での違いを理解したい

22:29:10
icon

tokio::runtimeの完全理解者を募集しています