rt: change max_threads to max_blocking_threads (#3287)

Fixes #2802
This commit is contained in:
Lucio Franco
2020-12-19 08:04:04 -08:00
committed by GitHub
parent d948ccedfc
commit b99b00eb30
2 changed files with 28 additions and 21 deletions
+12 -3
View File
@@ -331,7 +331,7 @@ fn coop_and_block_in_place() {
// runtime worker yielded as part of `block_in_place` and guarantees the
// same thread will reclaim the worker at the end of the
// `block_in_place` call.
.max_threads(1)
.max_blocking_threads(1)
.build()
.unwrap();
@@ -375,9 +375,18 @@ fn coop_and_block_in_place() {
// Testing this does not panic
#[test]
fn max_threads() {
fn max_blocking_threads() {
let _rt = tokio::runtime::Builder::new_multi_thread()
.max_threads(1)
.max_blocking_threads(1)
.build()
.unwrap();
}
#[test]
#[should_panic]
fn max_blocking_threads_set_to_zero() {
let _rt = tokio::runtime::Builder::new_multi_thread()
.max_blocking_threads(0)
.build()
.unwrap();
}