mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-06 00:00:10 +02:00
+21
-1
@@ -478,7 +478,7 @@ impl Inner {
|
|||||||
mio::Token(TOKEN_START + entry.index() * 2),
|
mio::Token(TOKEN_START + entry.index() * 2),
|
||||||
mio::Ready::readable() |
|
mio::Ready::readable() |
|
||||||
mio::Ready::writable() |
|
mio::Ready::writable() |
|
||||||
platform::hup(),
|
platform::all(),
|
||||||
mio::PollOpt::edge()));
|
mio::PollOpt::edge()));
|
||||||
Ok((sched.readiness.clone(), entry.insert(sched).index()))
|
Ok((sched.readiness.clone(), entry.insert(sched).index()))
|
||||||
}
|
}
|
||||||
@@ -807,16 +807,28 @@ mod platform {
|
|||||||
use mio::Ready;
|
use mio::Ready;
|
||||||
use mio::unix::UnixReady;
|
use mio::unix::UnixReady;
|
||||||
|
|
||||||
|
pub fn aio() -> Ready {
|
||||||
|
UnixReady::aio().into()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn all() -> Ready {
|
||||||
|
hup() | aio()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn hup() -> Ready {
|
pub fn hup() -> Ready {
|
||||||
UnixReady::hup().into()
|
UnixReady::hup().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
const HUP: usize = 1 << 2;
|
const HUP: usize = 1 << 2;
|
||||||
const ERROR: usize = 1 << 3;
|
const ERROR: usize = 1 << 3;
|
||||||
|
const AIO: usize = 1 << 4;
|
||||||
|
|
||||||
pub fn ready2usize(ready: Ready) -> usize {
|
pub fn ready2usize(ready: Ready) -> usize {
|
||||||
let ready = UnixReady::from(ready);
|
let ready = UnixReady::from(ready);
|
||||||
let mut bits = 0;
|
let mut bits = 0;
|
||||||
|
if ready.is_aio() {
|
||||||
|
bits |= AIO;
|
||||||
|
}
|
||||||
if ready.is_error() {
|
if ready.is_error() {
|
||||||
bits |= ERROR;
|
bits |= ERROR;
|
||||||
}
|
}
|
||||||
@@ -828,6 +840,9 @@ mod platform {
|
|||||||
|
|
||||||
pub fn usize2ready(bits: usize) -> Ready {
|
pub fn usize2ready(bits: usize) -> Ready {
|
||||||
let mut ready = UnixReady::from(Ready::empty());
|
let mut ready = UnixReady::from(Ready::empty());
|
||||||
|
if bits & AIO != 0 {
|
||||||
|
ready.insert(UnixReady::aio());
|
||||||
|
}
|
||||||
if bits & HUP != 0 {
|
if bits & HUP != 0 {
|
||||||
ready.insert(UnixReady::hup());
|
ready.insert(UnixReady::hup());
|
||||||
}
|
}
|
||||||
@@ -842,6 +857,11 @@ mod platform {
|
|||||||
mod platform {
|
mod platform {
|
||||||
use mio::Ready;
|
use mio::Ready;
|
||||||
|
|
||||||
|
pub fn all() -> Ready {
|
||||||
|
// No platform-specific Readinesses for Windows
|
||||||
|
Ready::empty()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn hup() -> Ready {
|
pub fn hup() -> Ready {
|
||||||
Ready::empty()
|
Ready::empty()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user