Skip to content

Commit

Permalink
Implement Stream for signal::unix::Signal (#1849)
Browse files Browse the repository at this point in the history
Refs #1848
  • Loading branch information
osa1 authored and ipetkov committed Nov 28, 2019
1 parent 524e663 commit cd73951
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tokio/src/signal/unix.rs
Expand Up @@ -404,6 +404,16 @@ impl Signal {
}
}

cfg_stream! {
impl futures_core::Stream for Signal {
type Item = ();

fn poll_next(mut self: std::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<()>> {
self.poll_recv(cx)
}
}
}

pub(crate) fn ctrl_c() -> io::Result<Signal> {
signal(SignalKind::interrupt())
}
Expand Down

0 comments on commit cd73951

Please sign in to comment.