mirror of
https://github.com/async-rs/async-std.git
synced 2025-04-28 03:06:49 +00:00
Update async-global-executor and add tokio feature for tokio 1.0
Co-authored-by: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
This commit is contained in:
parent
4a3f963810
commit
ac19c660c5
5 changed files with 17 additions and 5 deletions
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://book.async.rs/overview
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- Add `tokio1` feature ([#924](https://github.com/async-rs/async-std/pull/924))
|
||||||
|
|
||||||
# [1.8.0] - 2020-12-04
|
# [1.8.0] - 2020-12-04
|
||||||
|
|
||||||
This patch introduces `async_std::channel`, a new submodule for our async channels implementation. `channels` have been one of async-std's most requested features, and have existed as "unstable" for the past year. We've been cautious about stabilizing channels, and this caution turned out to be warranted: we realized our channels could hang indefinitely under certain circumstances, and people ended up expressing a need for unbounded channels.
|
This patch introduces `async_std::channel`, a new submodule for our async channels implementation. `channels` have been one of async-std's most requested features, and have existed as "unstable" for the past year. We've been cautious about stabilizing channels, and this caution turned out to be warranted: we realized our channels could hang indefinitely under certain circumstances, and people ended up expressing a need for unbounded channels.
|
||||||
|
|
|
@ -26,7 +26,6 @@ default = [
|
||||||
"std",
|
"std",
|
||||||
"async-global-executor",
|
"async-global-executor",
|
||||||
"async-io",
|
"async-io",
|
||||||
"blocking",
|
|
||||||
"futures-lite",
|
"futures-lite",
|
||||||
"kv-log-macro",
|
"kv-log-macro",
|
||||||
"log",
|
"log",
|
||||||
|
@ -59,6 +58,7 @@ alloc = [
|
||||||
"futures-core/alloc",
|
"futures-core/alloc",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
tokio1 = ["async-global-executor/tokio"]
|
||||||
tokio02 = ["async-global-executor/tokio02"]
|
tokio02 = ["async-global-executor/tokio02"]
|
||||||
tokio03 = ["async-global-executor/tokio03"]
|
tokio03 = ["async-global-executor/tokio03"]
|
||||||
|
|
||||||
|
@ -83,9 +83,8 @@ surf = { version = "2.0.0", optional = true }
|
||||||
|
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "unknown"))'.dependencies]
|
[target.'cfg(not(target_os = "unknown"))'.dependencies]
|
||||||
async-global-executor = { version = "1.4.0", optional = true, features = ["async-io"] }
|
async-global-executor = { version = "2.0.0", optional = true, features = ["async-io"] }
|
||||||
async-io = { version = "1.0.1", optional = true }
|
async-io = { version = "1.0.1", optional = true }
|
||||||
blocking = { version = "1.0.0", optional = true }
|
|
||||||
futures-lite = { version = "1.0.0", optional = true }
|
futures-lite = { version = "1.0.0", optional = true }
|
||||||
async-process = { version = "1.0.1", optional = true }
|
async-process = { version = "1.0.1", optional = true }
|
||||||
|
|
||||||
|
|
|
@ -213,6 +213,15 @@
|
||||||
//! features = ["attributes"]
|
//! features = ["attributes"]
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
//! Compatibility with the `tokio` 1.0 runtime is also simultaneously possible
|
||||||
|
//! using the `tokio1` Cargo feature:
|
||||||
|
//!
|
||||||
|
//! ```toml
|
||||||
|
//! [dependencies.async-std]
|
||||||
|
//! version = "1.7.0"
|
||||||
|
//! features = ["tokio1"]
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
//! Compatibility with the `tokio` 0.2 runtime is possible using the `tokio02`
|
//! Compatibility with the `tokio` 0.2 runtime is possible using the `tokio02`
|
||||||
//! Cargo feature:
|
//! Cargo feature:
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub static RUNTIME: Lazy<Runtime> = Lazy::new(|| {
|
||||||
// Create an executor thread pool.
|
// Create an executor thread pool.
|
||||||
|
|
||||||
let thread_name = env::var("ASYNC_STD_THREAD_NAME").unwrap_or_else(|_| "async-std/runtime".to_string());
|
let thread_name = env::var("ASYNC_STD_THREAD_NAME").unwrap_or_else(|_| "async-std/runtime".to_string());
|
||||||
async_global_executor::init_with_config(async_global_executor::GlobalExecutorConfig::default().with_env_var("ASYNC_STD_THREAD_COUNT").with_thread_name(thread_name));
|
async_global_executor::init_with_config(async_global_executor::GlobalExecutorConfig::default().with_env_var("ASYNC_STD_THREAD_COUNT").with_thread_name_fn(move || thread_name.clone()));
|
||||||
|
|
||||||
Runtime {}
|
Runtime {}
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,5 +35,5 @@ where
|
||||||
F: FnOnce() -> T + Send + 'static,
|
F: FnOnce() -> T + Send + 'static,
|
||||||
T: Send + 'static,
|
T: Send + 'static,
|
||||||
{
|
{
|
||||||
task::spawn(blocking::unblock(f))
|
task::spawn(async_global_executor::spawn_blocking(f))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue