mirror of https://github.com/smol-rs/polling
Compare commits
4 Commits
2e4e0355b6
...
866083103f
Author | SHA1 | Date |
---|---|---|
keepsimple1 | 866083103f | |
John Nunley | eb9d92a2e0 | |
Nikolay Arhipov | 9e46c8455c | |
Han Xu | ad676e3716 |
|
@ -81,15 +81,16 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
rust: [nightly, stable]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
run: rustup update stable
|
run: rustup update ${{ matrix.rust }}
|
||||||
- name: Install cross
|
- name: Install cross
|
||||||
uses: taiki-e/install-action@cross
|
uses: taiki-e/install-action@cross
|
||||||
- name: Add rust-src
|
- name: Add rust-src
|
||||||
if: startsWith(matrix.rust, 'nightly')
|
if: startsWith(matrix.rust, 'nightly')
|
||||||
run: rustup component add rust-src
|
run: rustup +nightly component add rust-src
|
||||||
# We don't test BSDs, since we already test them in Cirrus.
|
# We don't test BSDs, since we already test them in Cirrus.
|
||||||
- name: Android
|
- name: Android
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
|
@ -121,11 +122,13 @@ jobs:
|
||||||
cargo check --target x86_64-unknown-redox
|
cargo check --target x86_64-unknown-redox
|
||||||
- name: HermitOS
|
- name: HermitOS
|
||||||
if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
|
if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
|
||||||
run: |
|
run: cargo +nightly check -Z build-std --target x86_64-unknown-hermit
|
||||||
cargo -Zbuild-std check --target x86_64-unknown-hermit
|
|
||||||
- name: Check haiku
|
- name: Check haiku
|
||||||
if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
|
if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
|
||||||
run: cargo check -Z build-std --target x86_64-unknown-haiku
|
run: cargo +nightly check -Z build-std --target x86_64-unknown-haiku
|
||||||
|
- name: Check vita
|
||||||
|
if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
|
||||||
|
run: cargo +nightly check -Z build-std --target armv7-sony-vita-newlibeabihf
|
||||||
|
|
||||||
wine:
|
wine:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# Version 3.7.0
|
||||||
|
|
||||||
|
- Add support for the PS Vita as a platform. (#160)
|
||||||
|
|
||||||
# Version 3.6.0
|
# Version 3.6.0
|
||||||
|
|
||||||
- Add an `is_err` method to `Event` to tell when an error has occurred. (#189)
|
- Add an `is_err` method to `Event` to tell when an error has occurred. (#189)
|
||||||
|
|
|
@ -3,7 +3,7 @@ name = "polling"
|
||||||
# When publishing a new version:
|
# When publishing a new version:
|
||||||
# - Update CHANGELOG.md
|
# - Update CHANGELOG.md
|
||||||
# - Create "v3.x.y" git tag
|
# - Create "v3.x.y" git tag
|
||||||
version = "3.6.0"
|
version = "3.7.0"
|
||||||
authors = ["Stjepan Glavina <stjepang@gmail.com>", "John Nunley <dev@notgull.net>"]
|
authors = ["Stjepan Glavina <stjepang@gmail.com>", "John Nunley <dev@notgull.net>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.63"
|
rust-version = "1.63"
|
||||||
|
@ -55,4 +55,6 @@ socket2 = "0.5.5"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dev-dependencies]
|
[target.'cfg(unix)'.dev-dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
|
||||||
|
[target.'cfg(all(unix, not(target_os="vita")))'.dev-dependencies]
|
||||||
signal-hook = "0.3.17"
|
signal-hook = "0.3.17"
|
||||||
|
|
|
@ -6,9 +6,7 @@ use socket2::Type;
|
||||||
fn main() -> io::Result<()> {
|
fn main() -> io::Result<()> {
|
||||||
let socket = socket2::Socket::new(socket2::Domain::IPV4, Type::STREAM, None)?;
|
let socket = socket2::Socket::new(socket2::Domain::IPV4, Type::STREAM, None)?;
|
||||||
let poller = polling::Poller::new()?;
|
let poller = polling::Poller::new()?;
|
||||||
unsafe {
|
poller.add(&socket, Event::new(0, true, true))?;
|
||||||
poller.add(&socket, Event::new(0, true, true))?;
|
|
||||||
}
|
|
||||||
let addr = net::SocketAddr::new(net::Ipv4Addr::LOCALHOST.into(), 8080);
|
let addr = net::SocketAddr::new(net::Ipv4Addr::LOCALHOST.into(), 8080);
|
||||||
socket.set_nonblocking(true)?;
|
socket.set_nonblocking(true)?;
|
||||||
let _ = socket.connect(&addr.into());
|
let _ = socket.connect(&addr.into());
|
||||||
|
|
|
@ -10,10 +10,8 @@ fn main() -> io::Result<()> {
|
||||||
l2.set_nonblocking(true)?;
|
l2.set_nonblocking(true)?;
|
||||||
|
|
||||||
let poller = Poller::new()?;
|
let poller = Poller::new()?;
|
||||||
unsafe {
|
poller.add(&l1, Event::readable(1))?;
|
||||||
poller.add(&l1, Event::readable(1))?;
|
poller.add(&l2, Event::readable(2))?;
|
||||||
poller.add(&l2, Event::readable(2))?;
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("You can connect to the server using `nc`:");
|
println!("You can connect to the server using `nc`:");
|
||||||
println!(" $ nc 127.0.0.1 8001");
|
println!(" $ nc 127.0.0.1 8001");
|
||||||
|
|
|
@ -84,11 +84,17 @@ impl Poller {
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
/// The file descriptor must be valid and it must last until it is deleted.
|
/// The file descriptor must be valid and it must last until it is deleted.
|
||||||
pub unsafe fn add(&self, fd: RawFd, ev: Event, mode: PollMode) -> io::Result<()> {
|
pub fn add(&self, fd: BorrowedFd<'_>, ev: Event, mode: PollMode) -> io::Result<()> {
|
||||||
self.add_source(SourceId::Fd(fd))?;
|
let rawfd = fd.as_raw_fd();
|
||||||
|
|
||||||
|
// SAFETY: `rawfd` is valid as it is from `BorrowedFd`. And
|
||||||
|
// this block never closes / deletes `rawfd`.
|
||||||
|
unsafe {
|
||||||
|
self.add_source(SourceId::Fd(rawfd))?;
|
||||||
|
}
|
||||||
|
|
||||||
// File descriptors don't need to be added explicitly, so just modify the interest.
|
// File descriptors don't need to be added explicitly, so just modify the interest.
|
||||||
self.modify(BorrowedFd::borrow_raw(fd), ev, mode)
|
self.modify(fd, ev, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Modifies an existing file descriptor.
|
/// Modifies an existing file descriptor.
|
||||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -402,7 +402,7 @@ impl Event {
|
||||||
|
|
||||||
/// Tells if this event is the result of a connection failure.
|
/// Tells if this event is the result of a connection failure.
|
||||||
///
|
///
|
||||||
/// This function checks if an error exist,particularlly useful in detecting if TCP connection failed. It corresponds to the `EPOLLERR` event in Linux
|
/// This function checks if an error exist, particularly useful in detecting if TCP connection failed. It corresponds to the `EPOLLERR` event in Linux
|
||||||
/// and `CONNECT_FAILED` event in Windows IOCP.
|
/// and `CONNECT_FAILED` event in Windows IOCP.
|
||||||
///
|
///
|
||||||
/// ## Caveats
|
/// ## Caveats
|
||||||
|
@ -529,7 +529,7 @@ impl Poller {
|
||||||
/// poller.delete(&source)?;
|
/// poller.delete(&source)?;
|
||||||
/// # std::io::Result::Ok(())
|
/// # std::io::Result::Ok(())
|
||||||
/// ```
|
/// ```
|
||||||
pub unsafe fn add(&self, source: impl AsRawSource, interest: Event) -> io::Result<()> {
|
pub fn add(&self, source: impl AsSource, interest: Event) -> io::Result<()> {
|
||||||
self.add_with_mode(source, interest, PollMode::Oneshot)
|
self.add_with_mode(source, interest, PollMode::Oneshot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,9 +548,9 @@ impl Poller {
|
||||||
///
|
///
|
||||||
/// If the operating system does not support the specified mode, this function
|
/// If the operating system does not support the specified mode, this function
|
||||||
/// will return an error.
|
/// will return an error.
|
||||||
pub unsafe fn add_with_mode(
|
pub fn add_with_mode(
|
||||||
&self,
|
&self,
|
||||||
source: impl AsRawSource,
|
source: impl AsSource,
|
||||||
interest: Event,
|
interest: Event,
|
||||||
mode: PollMode,
|
mode: PollMode,
|
||||||
) -> io::Result<()> {
|
) -> io::Result<()> {
|
||||||
|
@ -560,7 +560,7 @@ impl Poller {
|
||||||
"the key is not allowed to be `usize::MAX`",
|
"the key is not allowed to be `usize::MAX`",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
self.poller.add(source.raw(), interest, mode)
|
self.poller.add(source.as_fd(), interest, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Modifies the interest in a file descriptor or socket.
|
/// Modifies the interest in a file descriptor or socket.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! Functionality that is only availale for IOCP-based platforms.
|
//! Functionality that is only available for IOCP-based platforms.
|
||||||
|
|
||||||
pub use crate::sys::CompletionPacket;
|
pub use crate::sys::CompletionPacket;
|
||||||
|
|
||||||
|
|
24
src/poll.rs
24
src/poll.rs
|
@ -685,7 +685,7 @@ mod notify {
|
||||||
self.read_pipe.as_fd()
|
self.read_pipe.as_fd()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provides the poll flags to be used when registering the read half of the botify pipe with the `Poller`.
|
/// Provides the poll flags to be used when registering the read half of the notify pipe with the `Poller`.
|
||||||
pub(super) fn poll_flags(&self) -> PollFlags {
|
pub(super) fn poll_flags(&self) -> PollFlags {
|
||||||
PollFlags::RDNORM
|
PollFlags::RDNORM
|
||||||
}
|
}
|
||||||
|
@ -699,7 +699,25 @@ mod notify {
|
||||||
|
|
||||||
/// Pops a notification (if any) from the pipe.
|
/// Pops a notification (if any) from the pipe.
|
||||||
pub(super) fn pop_notification(&self) -> Result<(), io::Error> {
|
pub(super) fn pop_notification(&self) -> Result<(), io::Error> {
|
||||||
read(&self.read_pipe, &mut [0; 1])?;
|
// Pipes on Vita do not guarantee that after `write` call succeeds, the
|
||||||
|
// data becomes immediately available for reading on the other side of the pipe.
|
||||||
|
// To ensure that the notification is not lost, the read side of the pipe is temporarily
|
||||||
|
// switched to blocking for a single `read` call.
|
||||||
|
#[cfg(target_os = "vita")]
|
||||||
|
rustix::fs::fcntl_setfl(
|
||||||
|
&self.read_pipe,
|
||||||
|
rustix::fs::fcntl_getfl(&self.read_pipe)? & !rustix::fs::OFlags::NONBLOCK,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
let result = read(&self.read_pipe, &mut [0; 1]);
|
||||||
|
|
||||||
|
#[cfg(target_os = "vita")]
|
||||||
|
rustix::fs::fcntl_setfl(
|
||||||
|
&self.read_pipe,
|
||||||
|
rustix::fs::fcntl_getfl(&self.read_pipe)? | rustix::fs::OFlags::NONBLOCK,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
result?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -729,7 +747,7 @@ mod notify {
|
||||||
|
|
||||||
/// A notification pipe.
|
/// A notification pipe.
|
||||||
///
|
///
|
||||||
/// This implementation uses ther `eventfd` syscall to send notifications.
|
/// This implementation uses the `eventfd` syscall to send notifications.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(super) struct Notify {
|
pub(super) struct Notify {
|
||||||
/// The file descriptor of the eventfd object. This is also stored as the first
|
/// The file descriptor of the eventfd object. This is also stored as the first
|
||||||
|
|
|
@ -20,9 +20,7 @@ fn concurrent_add() -> io::Result<()> {
|
||||||
})
|
})
|
||||||
.add(|| {
|
.add(|| {
|
||||||
thread::sleep(Duration::from_millis(100));
|
thread::sleep(Duration::from_millis(100));
|
||||||
unsafe {
|
poller.add(&reader, Event::readable(0))?;
|
||||||
poller.add(&reader, Event::readable(0))?;
|
|
||||||
}
|
|
||||||
writer.write_all(&[1])?;
|
writer.write_all(&[1])?;
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
@ -46,9 +44,7 @@ fn concurrent_add() -> io::Result<()> {
|
||||||
fn concurrent_modify() -> io::Result<()> {
|
fn concurrent_modify() -> io::Result<()> {
|
||||||
let (reader, mut writer) = tcp_pair()?;
|
let (reader, mut writer) = tcp_pair()?;
|
||||||
let poller = Poller::new()?;
|
let poller = Poller::new()?;
|
||||||
unsafe {
|
poller.add(&reader, Event::none(0))?;
|
||||||
poller.add(&reader, Event::none(0))?;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut events = Events::new();
|
let mut events = Events::new();
|
||||||
|
|
||||||
|
@ -76,7 +72,7 @@ fn concurrent_modify() -> io::Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(all(unix, not(target_os = "vita")))]
|
||||||
#[test]
|
#[test]
|
||||||
fn concurrent_interruption() -> io::Result<()> {
|
fn concurrent_interruption() -> io::Result<()> {
|
||||||
struct MakeItSend<T>(T);
|
struct MakeItSend<T>(T);
|
||||||
|
@ -84,9 +80,7 @@ fn concurrent_interruption() -> io::Result<()> {
|
||||||
|
|
||||||
let (reader, _writer) = tcp_pair()?;
|
let (reader, _writer) = tcp_pair()?;
|
||||||
let poller = Poller::new()?;
|
let poller = Poller::new()?;
|
||||||
unsafe {
|
poller.add(&reader, Event::none(0))?;
|
||||||
poller.add(&reader, Event::none(0))?;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut events = Events::new();
|
let mut events = Events::new();
|
||||||
let events_borrow = &mut events;
|
let events_borrow = &mut events;
|
||||||
|
|
26
tests/io.rs
26
tests/io.rs
|
@ -8,9 +8,7 @@ use std::time::Duration;
|
||||||
fn basic_io() {
|
fn basic_io() {
|
||||||
let poller = Poller::new().unwrap();
|
let poller = Poller::new().unwrap();
|
||||||
let (read, mut write) = tcp_pair().unwrap();
|
let (read, mut write) = tcp_pair().unwrap();
|
||||||
unsafe {
|
poller.add(&read, Event::readable(1)).unwrap();
|
||||||
poller.add(&read, Event::readable(1)).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nothing should be available at first.
|
// Nothing should be available at first.
|
||||||
let mut events = Events::new();
|
let mut events = Events::new();
|
||||||
|
@ -42,7 +40,7 @@ fn basic_io() {
|
||||||
#[test]
|
#[test]
|
||||||
fn insert_twice() {
|
fn insert_twice() {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::io::AsRawFd;
|
use std::os::unix::io::AsFd;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use std::os::windows::io::AsRawSocket;
|
use std::os::windows::io::AsRawSocket;
|
||||||
|
|
||||||
|
@ -50,18 +48,16 @@ fn insert_twice() {
|
||||||
let read = Arc::new(read);
|
let read = Arc::new(read);
|
||||||
|
|
||||||
let poller = Poller::new().unwrap();
|
let poller = Poller::new().unwrap();
|
||||||
unsafe {
|
#[cfg(unix)]
|
||||||
#[cfg(unix)]
|
let read = read.as_fd();
|
||||||
let read = read.as_raw_fd();
|
#[cfg(windows)]
|
||||||
#[cfg(windows)]
|
let read = read.as_raw_socket();
|
||||||
let read = read.as_raw_socket();
|
|
||||||
|
|
||||||
poller.add(read, Event::readable(1)).unwrap();
|
poller.add(read, Event::readable(1)).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
poller.add(read, Event::readable(1)).unwrap_err().kind(),
|
poller.add(read, Event::readable(1)).unwrap_err().kind(),
|
||||||
io::ErrorKind::AlreadyExists
|
io::ErrorKind::AlreadyExists
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
write.write_all(&[1]).unwrap();
|
write.write_all(&[1]).unwrap();
|
||||||
let mut events = Events::new();
|
let mut events = Events::new();
|
||||||
|
|
|
@ -22,9 +22,7 @@ fn many_connections() {
|
||||||
let poller = polling::Poller::new().unwrap();
|
let poller = polling::Poller::new().unwrap();
|
||||||
|
|
||||||
for (i, reader, _) in connections.iter() {
|
for (i, reader, _) in connections.iter() {
|
||||||
unsafe {
|
poller.add(reader, polling::Event::readable(*i)).unwrap();
|
||||||
poller.add(reader, polling::Event::readable(*i)).unwrap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut events = Events::new();
|
let mut events = Events::new();
|
||||||
|
|
|
@ -18,14 +18,12 @@ fn level_triggered() {
|
||||||
|
|
||||||
// Register the source into both pollers.
|
// Register the source into both pollers.
|
||||||
let (mut reader, mut writer) = tcp_pair().unwrap();
|
let (mut reader, mut writer) = tcp_pair().unwrap();
|
||||||
unsafe {
|
poller1
|
||||||
poller1
|
.add_with_mode(&reader, Event::readable(1), PollMode::Level)
|
||||||
.add_with_mode(&reader, Event::readable(1), PollMode::Level)
|
.unwrap();
|
||||||
.unwrap();
|
poller2
|
||||||
poller2
|
.add_with_mode(&reader, Event::readable(2), PollMode::Level)
|
||||||
.add_with_mode(&reader, Event::readable(2), PollMode::Level)
|
.unwrap();
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Neither poller should have any events.
|
// Neither poller should have any events.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -139,14 +137,12 @@ fn edge_triggered() {
|
||||||
|
|
||||||
// Register the source into both pollers.
|
// Register the source into both pollers.
|
||||||
let (mut reader, mut writer) = tcp_pair().unwrap();
|
let (mut reader, mut writer) = tcp_pair().unwrap();
|
||||||
unsafe {
|
poller1
|
||||||
poller1
|
.add_with_mode(&reader, Event::readable(1), PollMode::Edge)
|
||||||
.add_with_mode(&reader, Event::readable(1), PollMode::Edge)
|
.unwrap();
|
||||||
.unwrap();
|
poller2
|
||||||
poller2
|
.add_with_mode(&reader, Event::readable(2), PollMode::Edge)
|
||||||
.add_with_mode(&reader, Event::readable(2), PollMode::Edge)
|
.unwrap();
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Neither poller should have any events.
|
// Neither poller should have any events.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -256,14 +252,12 @@ fn oneshot_triggered() {
|
||||||
|
|
||||||
// Register the source into both pollers.
|
// Register the source into both pollers.
|
||||||
let (mut reader, mut writer) = tcp_pair().unwrap();
|
let (mut reader, mut writer) = tcp_pair().unwrap();
|
||||||
unsafe {
|
poller1
|
||||||
poller1
|
.add_with_mode(&reader, Event::readable(1), PollMode::Oneshot)
|
||||||
.add_with_mode(&reader, Event::readable(1), PollMode::Oneshot)
|
.unwrap();
|
||||||
.unwrap();
|
poller2
|
||||||
poller2
|
.add_with_mode(&reader, Event::readable(2), PollMode::Oneshot)
|
||||||
.add_with_mode(&reader, Event::readable(2), PollMode::Oneshot)
|
.unwrap();
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Neither poller should have any events.
|
// Neither poller should have any events.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
@ -16,7 +16,8 @@ fn level_triggered() {
|
||||||
|
|
||||||
// Create our poller and register our streams.
|
// Create our poller and register our streams.
|
||||||
let poller = Poller::new().unwrap();
|
let poller = Poller::new().unwrap();
|
||||||
if unsafe { poller.add_with_mode(&reader, Event::readable(reader_token), PollMode::Level) }
|
if poller
|
||||||
|
.add_with_mode(&reader, Event::readable(reader_token), PollMode::Level)
|
||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
// Only panic if we're on a platform that should support level mode.
|
// Only panic if we're on a platform that should support level mode.
|
||||||
|
@ -104,7 +105,8 @@ fn edge_triggered() {
|
||||||
|
|
||||||
// Create our poller and register our streams.
|
// Create our poller and register our streams.
|
||||||
let poller = Poller::new().unwrap();
|
let poller = Poller::new().unwrap();
|
||||||
if unsafe { poller.add_with_mode(&reader, Event::readable(reader_token), PollMode::Edge) }
|
if poller
|
||||||
|
.add_with_mode(&reader, Event::readable(reader_token), PollMode::Edge)
|
||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
// Only panic if we're on a platform that should support level mode.
|
// Only panic if we're on a platform that should support level mode.
|
||||||
|
@ -194,14 +196,13 @@ fn edge_oneshot_triggered() {
|
||||||
|
|
||||||
// Create our poller and register our streams.
|
// Create our poller and register our streams.
|
||||||
let poller = Poller::new().unwrap();
|
let poller = Poller::new().unwrap();
|
||||||
if unsafe {
|
if poller
|
||||||
poller.add_with_mode(
|
.add_with_mode(
|
||||||
&reader,
|
&reader,
|
||||||
Event::readable(reader_token),
|
Event::readable(reader_token),
|
||||||
PollMode::EdgeOneshot,
|
PollMode::EdgeOneshot,
|
||||||
)
|
)
|
||||||
}
|
.is_err()
|
||||||
.is_err()
|
|
||||||
{
|
{
|
||||||
// Only panic if we're on a platform that should support level mode.
|
// Only panic if we're on a platform that should support level mode.
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
|
|
Loading…
Reference in New Issue