浏览代码

Drop

master
Noelle 5 年前
父节点
当前提交
f439c1417d
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10
    0
      src/lib.rs

+ 10
- 0
src/lib.rs 查看文件



} }


impl Drop for ThreadPool {
fn drop(&mut self) {
for worker in &mut self.workers {
println!("Shutting down worker {}", worker.id);

worker.thread.join().unwrap();
}
}
}

struct Worker { struct Worker {
id: usize, id: usize,
thread: thread::JoinHandle<()>, thread: thread::JoinHandle<()>,

正在加载...
取消
保存