Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime: immediately drop new task when runtime is shut down (#3752)
- Loading branch information
Showing
6 changed files
with
116 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use crate::runtime::{Builder, Handle}; | ||
|
||
#[test] | ||
fn join_handle_cancel_on_shutdown() { | ||
let mut builder = loom::model::Builder::new(); | ||
builder.preemption_bound = Some(2); | ||
builder.check(|| { | ||
use futures::future::FutureExt; | ||
|
||
let rt = Builder::new_multi_thread() | ||
.worker_threads(2) | ||
.build() | ||
.unwrap(); | ||
|
||
let handle = rt.block_on(async move { Handle::current() }); | ||
|
||
let jh1 = handle.spawn(futures::future::pending::<()>()); | ||
|
||
drop(rt); | ||
|
||
let jh2 = handle.spawn(futures::future::pending::<()>()); | ||
|
||
let err1 = jh1.now_or_never().unwrap().unwrap_err(); | ||
let err2 = jh2.now_or_never().unwrap().unwrap_err(); | ||
assert!(err1.is_cancelled()); | ||
assert!(err2.is_cancelled()); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a39e6c2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'sync_mpsc'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.send_large
58437
ns/iter (± 7804
)27153
ns/iter (± 3075
)2.15
This comment was automatically generated by workflow using github-action-benchmark.
CC: @tokio-rs/maintainers