diff --git a/Cargo.toml b/Cargo.toml index a2b703f..34285dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" ahash = "0.8.3" futures-lite = "1.13.0" iou = "0.3.3" -nix = { version = "0.27.1", features = ["sched"] } +nix = { version = "0.27.1", features = ["sched", "fs"] } polling = "2.8.0" scoped-tls = "1.0.1" diff --git a/src/executor/local_executor_test.rs b/src/executor/local_executor_test.rs index 6bd835c..b33162b 100644 --- a/src/executor/local_executor_test.rs +++ b/src/executor/local_executor_test.rs @@ -24,6 +24,7 @@ fn simple_spawn() { #[test] fn local_executor_builder_placement() { + // The LocalExecutor will now only run on Cpu 0 let builder = LocalExecutorBuilder::new(Placement::Fixed(0)); let local_ex = builder.build(); let res = local_ex.run(async { diff --git a/src/net/async_networking.rs b/src/net/async_networking.rs index 59a9804..a5a5093 100644 --- a/src/net/async_networking.rs +++ b/src/net/async_networking.rs @@ -9,7 +9,6 @@ impl Async { pub fn bind>(addr: A) -> io::Result> { let addr = addr.into(); let listener = TcpListener::bind(addr)?; - listener.set_nonblocking(true).unwrap(); Ok(Async::new(listener)?) } diff --git a/src/reactor.rs b/src/reactor.rs index ca8423d..b8c479c 100644 --- a/src/reactor.rs +++ b/src/reactor.rs @@ -1,5 +1,7 @@ use std::{io, os::fd::RawFd}; +use nix::fcntl::{self, fcntl, FcntlArg, OFlag}; + use crate::{ executor::executor, sys::{self, source::Source, SourceType}, @@ -29,6 +31,7 @@ impl Reactor { } pub fn insert_pollable_io(&self, raw: RawFd) -> Source { + fcntl(raw, FcntlArg::F_SETFL(OFlag::O_NONBLOCK)).unwrap(); self.new_source(raw, SourceType::PollableFd) }