mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-07 00:00:09 +02:00
task: clear LocalSet's remote queue on drop
Fixes #1885 Signed-off-by: Eliza Weisman <[email protected]>
This commit is contained in:
@@ -481,6 +481,15 @@ impl fmt::Debug for Scheduler {
|
||||
|
||||
impl Drop for Scheduler {
|
||||
fn drop(&mut self) {
|
||||
// Close the remote queue
|
||||
let mut lock = self.remote_queue.lock().unwrap();
|
||||
|
||||
while let Some(task) = lock.pop_front() {
|
||||
task.shutdown();
|
||||
}
|
||||
|
||||
drop(lock);
|
||||
|
||||
// Drain all local tasks
|
||||
while let Some(task) = self.next_local_task() {
|
||||
task.shutdown();
|
||||
|
||||
Reference in New Issue
Block a user