Skip to content

Day 16 - 并发编程 ​

spawn线程 ​

rust
use std::thread;

let handle = thread::spawn(|| {
    println!("Hello from thread");
});
handle.join().unwrap();

共享数据 ​

rust
use std::sync::Mutex;

let data = Mutex::new(0);
{
    let mut d = data.lock().unwrap();
    *d = 1;
}

📅 学习进度 ​

Day主题状态
01-15基础✅
16并发编程✅
17async/await⬜

本文为Rust 30天学习计划第16天内容 ​

📚 导航 ​

| ← Day 15 - 上一章 | Day 17 - 下一章 →

最后更新: