mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
task: fix warning (#4960)
This commit is contained in:
parent
adc774bc4f
commit
01ebb0aa29
@ -188,40 +188,40 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ctrl_shutdown() {
|
fn ctrl_shutdown() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
|
|
||||||
rt.block_on(async {
|
rt.block_on(async {
|
||||||
let mut ctrl_shutdown = assert_ok!(crate::signal::windows::ctrl_shutdown());
|
let mut ctrl_shutdown = assert_ok!(crate::signal::windows::ctrl_shutdown());
|
||||||
|
|
||||||
// Windows doesn't have a good programmatic way of sending events
|
// Windows doesn't have a good programmatic way of sending events
|
||||||
// like sending signals on Unix, so we'll stub out the actual OS
|
// like sending signals on Unix, so we'll stub out the actual OS
|
||||||
// integration and test that our handling works.
|
// integration and test that our handling works.
|
||||||
unsafe {
|
unsafe {
|
||||||
super::handler(wincon::CTRL_SHUTDOWN_EVENT);
|
super::handler(wincon::CTRL_SHUTDOWN_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrl_shutdown.recv().await.unwrap();
|
ctrl_shutdown.recv().await.unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn ctrl_logoff() {
|
fn ctrl_logoff() {
|
||||||
let rt = rt();
|
let rt = rt();
|
||||||
|
|
||||||
rt.block_on(async {
|
rt.block_on(async {
|
||||||
let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff());
|
let mut ctrl_logoff = assert_ok!(crate::signal::windows::ctrl_logoff());
|
||||||
|
|
||||||
// Windows doesn't have a good programmatic way of sending events
|
// Windows doesn't have a good programmatic way of sending events
|
||||||
// like sending signals on Unix, so we'll stub out the actual OS
|
// like sending signals on Unix, so we'll stub out the actual OS
|
||||||
// integration and test that our handling works.
|
// integration and test that our handling works.
|
||||||
unsafe {
|
unsafe {
|
||||||
super::handler(wincon::CTRL_LOGOFF_EVENT);
|
super::handler(wincon::CTRL_LOGOFF_EVENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrl_logoff.recv().await.unwrap();
|
ctrl_logoff.recv().await.unwrap();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rt() -> Runtime {
|
fn rt() -> Runtime {
|
||||||
crate::runtime::Builder::new_current_thread()
|
crate::runtime::Builder::new_current_thread()
|
||||||
|
@ -439,7 +439,7 @@ impl<'a, T: 'static> Builder<'a, T> {
|
|||||||
/// [`AbortHandle`]: crate::task::AbortHandle
|
/// [`AbortHandle`]: crate::task::AbortHandle
|
||||||
/// [runtime handle]: crate::runtime::Handle
|
/// [runtime handle]: crate::runtime::Handle
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn spawn_on<F>(mut self, future: F, handle: &Handle) -> std::io::Result<AbortHandle>
|
pub fn spawn_on<F>(self, future: F, handle: &Handle) -> std::io::Result<AbortHandle>
|
||||||
where
|
where
|
||||||
F: Future<Output = T>,
|
F: Future<Output = T>,
|
||||||
F: Send + 'static,
|
F: Send + 'static,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user