mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
tokio-reactor: impl AsRawFd for reactor for unix (#890)
In order to support nesting a tokio reactor within another event system exposing the file descriptor for the underlying reactor is useful and is already implemented for mio::Poll. Signed-off-by: Paul Osborne <[email protected]>
This commit is contained in:
committed by
Carl Lerche
parent
d0cdcff8aa
commit
f513558076
@@ -74,6 +74,8 @@ use std::sync::atomic::Ordering::{Relaxed, SeqCst};
|
|||||||
use std::sync::atomic::AtomicUsize;
|
use std::sync::atomic::AtomicUsize;
|
||||||
use std::sync::{Arc, Weak};
|
use std::sync::{Arc, Weak};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
#[cfg(all(unix, not(target_os = "fuchsia")))]
|
||||||
|
use std::os::unix::io::{AsRawFd, RawFd};
|
||||||
|
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use mio::event::Evented;
|
use mio::event::Evented;
|
||||||
@@ -429,6 +431,13 @@ impl Reactor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(all(unix, not(target_os = "fuchsia")))]
|
||||||
|
impl AsRawFd for Reactor {
|
||||||
|
fn as_raw_fd(&self) -> RawFd {
|
||||||
|
self.inner.io.as_raw_fd()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Park for Reactor {
|
impl Park for Reactor {
|
||||||
type Unpark = Handle;
|
type Unpark = Handle;
|
||||||
type Error = io::Error;
|
type Error = io::Error;
|
||||||
|
|||||||
Reference in New Issue
Block a user