mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-22 00:00:11 +02:00
threadpool: impl Drop for Queue (#649)
We need to drain the queue when dropping, or else those `Arc<Task>`s will be leaked. Fixes #542
This commit is contained in:
committed by
Carl Lerche
parent
3dd95a9ff1
commit
20ca59114a
@@ -115,3 +115,13 @@ impl Queue {
|
||||
Poll::Inconsistent
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Queue {
|
||||
fn drop(&mut self) {
|
||||
loop {
|
||||
if let Poll::Empty = unsafe { self.poll() } {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user