mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-16 00:00:12 +02:00
4dd3d30f2a2ba62007da0a0485a92757f9693385
This commit adds a general-purpose method for querying the readiness of a `PollEvented` type. This new method, `poll_ready`, takes a blanket `mio::Ready` and tests if any part of it is ready. The purpose of this is to expose platform-specific events through `PollReady` such as `hup` and `error` events other than just the platform-agnostic readable/writable events. The semanatics of this method are: * The `poll_ready` function takes a mask, and the return value is either `Async::Ready` with a subset of these events that are ready or `None` if none of them are ready. * There can be up to two tasks blocked on a `PollEvented`, so we need to pick which one is suitable for these new events. Currently all events are routed to the `read` task unless the writable bit is set. This is mostly only relevant for multi-task usage or if you're manually calling `need_read` and/or `need_write`, and hopefully the docs will cover this now.
tokio-core
Core I/O and event loop abstraction for asynchronous I/O in Rust built on
futures and mio.
Usage
First, add this to your Cargo.toml:
[dependencies]
tokio-core = "0.1"
Next, add this to your crate:
extern crate tokio_core;
You can find extensive documentation and examples about how to use this crate
online at https://tokio.rs as well as the examples folder
in this repository. The API documentation is also
a great place to get started for the nitty-gritty.
License
tokio-core is primarily distributed under the terms of both the MIT license
and the Apache License (Version 2.0), with portions covered by various BSD-like
licenses.
See LICENSE-APACHE, and LICENSE-MIT for details.
Languages
Rust
100%