Skip to content

Commit

Permalink
WIP: Bump tokio to 0.3 and mio to 0.7
Browse files Browse the repository at this point in the history
This is currently pending on tokio-rs/tokio#2903
in order to support registering a fd as a tokio Source.
  • Loading branch information
linkmauve committed Oct 16, 2020
1 parent 5deb6af commit c3b0c4f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion conch-runtime-tests/Cargo.toml
Expand Up @@ -12,5 +12,5 @@ futures-core = "0.3"
futures-util = "0.3"
tempfile = "3.1"
thiserror = "1"
tokio = { version = "0.2", features = ["full"] }
tokio = { version = "0.3", features = ["full"] }
void = "1"
6 changes: 3 additions & 3 deletions conch-runtime/Cargo.toml
Expand Up @@ -26,12 +26,12 @@ futures-util = "0.3"
glob = "0.3"
lazy_static = "1"
thiserror = "1"
tokio = { version = "0.2", features = ["fs", "io-util", "process"] }
tokio = { version = "0.3", features = ["fs", "io-util", "process", "rt"] }
void = "1"

[target.'cfg(unix)'.dependencies]
libc = "0.2"
mio = "0.6"
mio = "0.7"

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3.4"
Expand All @@ -48,7 +48,7 @@ features = [

[dev-dependencies]
owned_chars = "0.3"
tokio = { version = "0.2", features = ["macros"] }
tokio = { version = "0.3", features = ["macros"] }

[badges]
travis-ci = { repository = "ipetkov/conch-runtime" }
Expand Down
2 changes: 1 addition & 1 deletion conch-runtime/src/env/executable.rs
Expand Up @@ -100,7 +100,7 @@ impl ExecutableEnvironment for TokioExecEnv {
.map_err(|err| map_io_err(err, name.to_string_lossy().into_owned()))?;

Ok(Box::pin(async move {
child.await.map(ExitStatus::from).unwrap_or(EXIT_ERROR)
child.wait().await.map(ExitStatus::from).unwrap_or(EXIT_ERROR)
}))
}
}
Expand Down
24 changes: 11 additions & 13 deletions conch-runtime/src/sys/unix/io.rs
Expand Up @@ -49,29 +49,27 @@ impl From<File> for FileDesc {
}
}

impl mio::Evented for FileDesc {
impl mio::event::Source for FileDesc {
fn register(
&self,
poll: &mio::Poll,
&mut self,
registry: &mio::Registry,
token: mio::Token,
interest: mio::Ready,
opts: mio::PollOpt,
interests: mio::Interest,
) -> Result<()> {
mio::unix::EventedFd(&self.as_raw_fd()).register(poll, token, interest, opts)
mio::unix::SourceFd(&self.as_raw_fd()).register(registry, token, interests)
}

fn reregister(
&self,
poll: &mio::Poll,
&mut self,
registry: &mio::Registry,
token: mio::Token,
interest: mio::Ready,
opts: mio::PollOpt,
interests: mio::Interest,
) -> Result<()> {
mio::unix::EventedFd(&self.as_raw_fd()).reregister(poll, token, interest, opts)
mio::unix::SourceFd(&self.as_raw_fd()).reregister(registry, token, interests)
}

fn deregister(&self, poll: &mio::Poll) -> Result<()> {
mio::unix::EventedFd(&self.as_raw_fd()).deregister(poll)
fn deregister(&mut self, registry: &mio::Registry) -> Result<()> {
mio::unix::SourceFd(&self.as_raw_fd()).deregister(registry)
}
}

Expand Down

0 comments on commit c3b0c4f

Please sign in to comment.