Update async-executor

This commit is contained in:
Stjepan Glavina 2020-09-20 18:29:46 +02:00
parent 7192fc5066
commit 68d2db5091
3 changed files with 5 additions and 5 deletions

View File

@ -14,11 +14,11 @@ readme = "README.md"
[dependencies] [dependencies]
async-channel = "1.4.2" async-channel = "1.4.2"
async-executor = "1.1.1" async-executor = "1.3.0"
async-fs = "1.3.0" async-fs = "1.3.0"
async-io = "1.1.0" async-io = "1.1.0"
async-lock = "2.1.2" async-lock = "2.1.2"
async-net = "1.3.0" async-net = "1.4.1"
async-process = "1.0.0" async-process = "1.0.0"
blocking = "1.0.0" blocking = "1.0.0"
futures-lite = "1.4.0" futures-lite = "1.4.0"

View File

@ -32,7 +32,7 @@ fn main() -> io::Result<()> {
stream.write_all(req).await?; stream.write_all(req).await?;
let mut stdout = Unblock::new(std::io::stdout()); let mut stdout = Unblock::new(std::io::stdout());
io::copy(&stream, &mut stdout).await?; io::copy(stream, &mut stdout).await?;
Ok(()) Ok(())
}) })
} }

View File

@ -19,7 +19,7 @@
//! stream.write_all(req).await?; //! stream.write_all(req).await?;
//! //!
//! let mut stdout = Unblock::new(std::io::stdout()); //! let mut stdout = Unblock::new(std::io::stdout());
//! io::copy(&stream, &mut stdout).await?; //! io::copy(stream, &mut stdout).await?;
//! Ok(()) //! Ok(())
//! }) //! })
//! } //! }
@ -100,7 +100,7 @@ pub mod prelude {
/// }); /// });
/// ``` /// ```
pub fn spawn<T: Send + 'static>(future: impl Future<Output = T> + Send + 'static) -> Task<T> { pub fn spawn<T: Send + 'static>(future: impl Future<Output = T> + Send + 'static) -> Task<T> {
static GLOBAL: Lazy<Executor> = Lazy::new(|| { static GLOBAL: Lazy<Executor<'_>> = Lazy::new(|| {
let num_threads = { let num_threads = {
// Parse SMOL_THREADS or default to 1. // Parse SMOL_THREADS or default to 1.
std::env::var("SMOL_THREADS") std::env::var("SMOL_THREADS")