Skip to content

Commit

Permalink
add pool
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Feb 22, 2022
1 parent 3795bfe commit 89e11a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/std/pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ impl Pool {
self.idle.0.send(Some(Arc::new(task)));
}

/// close just now
pub fn close(&self) {
while self.idle.1.remain() > 0 {
self.idle.1.try_recv();
}
self.idle.0.send(None);
}

/// close when all task finish
pub fn close_finish(&self) {
self.idle.0.send(None);
}

pub fn is_close(&self) -> bool {
self.closed.load(Ordering::SeqCst)
}
Expand Down

0 comments on commit 89e11a7

Please sign in to comment.