Skip to content

Commit 5eaf7c8

Browse files
author
Stjepan Glavina
committed
Update polling
1 parent 16329b9 commit 5eaf7c8

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ futures-lite = "0.1.10"
1919
libc = "0.2.74"
2020
once_cell = "1.4.0"
2121
parking = "2.0.0"
22-
polling = "0.1.0"
22+
polling = "0.1.3"
2323
socket2 = { version = "0.3.12", features = ["pair", "unix"] }
2424
vec-arena = "0.5.0"
2525

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The purpose of this thread is to wait for I/O events reported by the operating s
2929
wake appropriate futures blocked on I/O or timers when they can be resumed.
3030

3131
To wait for the next I/O event, the "async-io" thread uses [epoll] on Linux/Android/illumos,
32-
[kqueue] on macOS/iOS/BSD, and [wepoll] on Windows.
32+
[kqueue] on macOS/iOS/BSD, [event ports] on illumos/Solaris, and [wepoll] on Windows.
3333

3434
However, note that you can also process I/O events and wake futures manually if using the
3535
`parking` module. The "async-io" thread is therefore just a fallback mechanism processing I/O
@@ -39,6 +39,7 @@ See the `parking` module for more details.
3939

4040
[epoll]: https://en.wikipedia.org/wiki/Epoll
4141
[kqueue]: https://en.wikipedia.org/wiki/Kqueue
42+
[event ports]: https://illumos.org/man/port_create
4243
[wepoll]: https://github.com/piscisaureus/wepoll
4344

4445
## Examples

src/lib.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//! wake appropriate futures blocked on I/O or timers when they can be resumed.
1919
//!
2020
//! To wait for the next I/O event, the "async-io" thread uses [epoll] on Linux/Android/illumos,
21-
//! [kqueue] on macOS/iOS/BSD, and [wepoll] on Windows.
21+
//! [kqueue] on macOS/iOS/BSD, [event ports] on illumos/Solaris, and [wepoll] on Windows.
2222
//!
2323
//! However, note that you can also process I/O events and wake futures manually if using the
2424
//! [`parking`] module. The "async-io" thread is therefore just a fallback mechanism processing I/O
@@ -28,6 +28,7 @@
2828
//!
2929
//! [epoll]: https://en.wikipedia.org/wiki/Epoll
3030
//! [kqueue]: https://en.wikipedia.org/wiki/Kqueue
31+
//! [event ports]: https://illumos.org/man/port_create
3132
//! [wepoll]: https://github.com/piscisaureus/wepoll
3233
//!
3334
//! # Examples
@@ -210,14 +211,15 @@ impl Future for Timer {
210211
/// Async I/O.
211212
///
212213
/// This type converts a blocking I/O type into an async type, provided it is supported by
213-
/// [epoll]/[kqueue]/[wepoll].
214+
/// [epoll]/[kqueue]/[event ports]/[wepoll].
214215
///
215216
/// **NOTE:** Do not use this type with [`File`][`std::fs::File`], [`Stdin`][`std::io::Stdin`],
216217
/// [`Stdout`][`std::io::Stdout`], or [`Stderr`][`std::io::Stderr`] because they're not
217218
/// supported.
218219
///
219220
/// [epoll]: https://en.wikipedia.org/wiki/Epoll
220221
/// [kqueue]: https://en.wikipedia.org/wiki/Kqueue
222+
/// [event ports]: https://illumos.org/man/port_create
221223
/// [wepoll]: https://github.com/piscisaureus/wepoll
222224
///
223225
/// # Examples
@@ -268,13 +270,14 @@ impl<T: AsRawFd> Async<T> {
268270
/// Creates an async I/O handle.
269271
///
270272
/// This function will put the handle in non-blocking mode and register it in
271-
/// [epoll]/[kqueue]/[wepoll].
273+
/// [epoll]/[kqueue]/[event ports]/[wepoll].
272274
///
273275
/// On Unix systems, the handle must implement `AsRawFd`, while on Windows it must implement
274276
/// `AsRawSocket`.
275277
///
276278
/// [epoll]: https://en.wikipedia.org/wiki/Epoll
277279
/// [kqueue]: https://en.wikipedia.org/wiki/Kqueue
280+
/// [event ports]: https://illumos.org/man/port_create
278281
/// [wepoll]: https://github.com/piscisaureus/wepoll
279282
///
280283
/// # Examples
@@ -308,13 +311,14 @@ impl<T: AsRawSocket> Async<T> {
308311
/// Creates an async I/O handle.
309312
///
310313
/// This function will put the handle in non-blocking mode and register it in
311-
/// [epoll]/[kqueue]/[wepoll].
314+
/// [epoll]/[kqueue]/[event ports]/[wepoll].
312315
///
313316
/// On Unix systems, the handle must implement `AsRawFd`, while on Windows it must implement
314317
/// `AsRawSocket`.
315318
///
316319
/// [epoll]: https://en.wikipedia.org/wiki/Epoll
317320
/// [kqueue]: https://en.wikipedia.org/wiki/Kqueue
321+
/// [event ports]: https://illumos.org/man/port_create
318322
/// [wepoll]: https://github.com/piscisaureus/wepoll
319323
///
320324
/// # Examples
@@ -1314,7 +1318,7 @@ async fn optimistic(fut: impl Future<Output = io::Result<()>>) -> io::Result<()>
13141318
/// Shuts down the write side of a socket.
13151319
///
13161320
/// If this source is not a socket, the `shutdown()` syscall error is ignored.
1317-
pub fn shutdown_write(#[cfg(unix)] raw: RawFd, #[cfg(windows)] raw: RawSocket) -> io::Result<()> {
1321+
fn shutdown_write(#[cfg(unix)] raw: RawFd, #[cfg(windows)] raw: RawSocket) -> io::Result<()> {
13181322
// This may not be a TCP stream, but that's okay. All we do is attempt a `shutdown()` on the
13191323
// raw descriptor and ignore errors.
13201324
let stream = unsafe {

src/parking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Thread parking and unparking.
22
//!
33
//! This module exposes the exact same API as the [`parking`][docs-parking] crate. The only
4-
//! difference is that [`Parker`] in this module will wait on epoll/kqueue/wepoll and wake futures
5-
//! blocked on I/O or timers instead of *just* sleeping.
4+
//! difference is that [`Parker`] in this module will wait on epoll/kqueue/event ports/wepoll and
5+
//! wake futures blocked on I/O or timers instead of *just* sleeping.
66
//!
77
//! Executors may use this mechanism to go to sleep when idle and wake up when more work is
88
//! scheduled. The benefit is in that when going to sleep using [`Parker`], futures blocked on I/O

src/reactor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(crate) struct Reactor {
2828
/// Unparks the async-io thread.
2929
thread_unparker: parking::Unparker,
3030

31-
/// Bindings to epoll/kqueue/wepoll.
31+
/// Bindings to epoll/kqueue/event ports/wepoll.
3232
poller: Poller,
3333

3434
/// Ticker bumped before polling.

0 commit comments

Comments
 (0)