mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
runtime: test for shutdown_timeout(0) (#3196)
This commit is contained in:
parent
c55d846f4b
commit
a85fdb884d
@ -857,6 +857,21 @@ rt_test! {
|
|||||||
Arc::try_unwrap(runtime).unwrap().shutdown_timeout(Duration::from_millis(100));
|
Arc::try_unwrap(runtime).unwrap().shutdown_timeout(Duration::from_millis(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn shutdown_timeout_0() {
|
||||||
|
let runtime = rt();
|
||||||
|
|
||||||
|
runtime.block_on(async move {
|
||||||
|
task::spawn_blocking(move || {
|
||||||
|
thread::sleep(Duration::from_secs(10_000));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
let now = Instant::now();
|
||||||
|
Arc::try_unwrap(runtime).unwrap().shutdown_timeout(Duration::from_nanos(0));
|
||||||
|
assert!(now.elapsed().as_secs() < 1);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn shutdown_wakeup_time() {
|
fn shutdown_wakeup_time() {
|
||||||
let runtime = rt();
|
let runtime = rt();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user