mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
fix another issue
This commit is contained in:
parent
22ccfe48c1
commit
fab5adc17c
@ -541,11 +541,15 @@ impl Worker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug_assert!(cx.defer.borrow().is_empty());
|
||||||
|
|
||||||
self.pre_shutdown(cx, &mut core);
|
self.pre_shutdown(cx, &mut core);
|
||||||
|
|
||||||
// Signal shutdown
|
// Signal shutdown
|
||||||
self.shutdown_core(cx, core);
|
self.shutdown_core(cx, core);
|
||||||
|
|
||||||
|
debug_assert!(cx.defer.borrow().is_empty());
|
||||||
|
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,6 +581,7 @@ impl Worker {
|
|||||||
|
|
||||||
// If shutting down, abort
|
// If shutting down, abort
|
||||||
if cx.shared().inject.is_closed(&synced.inject) {
|
if cx.shared().inject.is_closed(&synced.inject) {
|
||||||
|
self.shutdown_clear_defer(cx);
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,6 +659,9 @@ impl Worker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shutting down, drop any deferred tasks
|
||||||
|
self.shutdown_clear_defer(cx);
|
||||||
|
|
||||||
Ok((None, core))
|
Ok((None, core))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1051,6 +1059,7 @@ impl Worker {
|
|||||||
cx.shared().driver.set(driver);
|
cx.shared().driver.set(driver);
|
||||||
|
|
||||||
if cx.shared().inject.is_closed(&mut synced.inject) {
|
if cx.shared().inject.is_closed(&mut synced.inject) {
|
||||||
|
self.shutdown_clear_defer(cx);
|
||||||
self.shutdown_finalize(cx, synced);
|
self.shutdown_finalize(cx, synced);
|
||||||
return Err(());
|
return Err(());
|
||||||
}
|
}
|
||||||
@ -1167,6 +1176,14 @@ impl Worker {
|
|||||||
core.global_queue_interval = next;
|
core.global_queue_interval = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn shutdown_clear_defer(&self, cx: &Context) {
|
||||||
|
let mut defer = cx.defer.borrow_mut();
|
||||||
|
|
||||||
|
for task in defer.drain(..) {
|
||||||
|
drop(task);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Context {
|
impl Context {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user