Carl Lerche 2eabc37599
I/O resources lazily bind to reactor. (#160)
This patch makes a significant change to how I/O resources bind to a
reactor. Currently, an I/O resource (TCP, UDP, PollEvented) will bind
itself with a reactor upon creation.

First, some history.

Originally, tokio-core required that I/O resources be explicitly
associated with a reactor upon creation by passing in a `&Handle`. Tokio
reform introduced a default reactor. If I/O resources do not specify a
reactor upon creation, then the default reactor is used.

However, futures tend to favor being lazy. Creating a future should do
no work, instead it is defining a computation to be performed once the
future is executed. Binding an I/O resource with a reactor on creation
goes against this pattern.

This patch fixes this by allowing I/O resources to lazily bind to a
reactor. An explicit `&Handle` can still be used on creation, but if no
reactor is specified, then the default reactor is used. However, this
binding happens during execution time (read / write) and not creation.
2018-02-28 09:03:13 -08:00
2018-02-09 14:30:32 -08:00
2016-08-26 14:56:21 -07:00
2018-02-20 15:13:52 -08:00
2018-02-27 09:35:50 -08:00

Tokio

A platform for writing fast networking code with Rust.

Travis Build Status Appveyor Build Status

Website | Guides | API Docs

Overview

Tokio is an event-driven, non-blocking I/O platform for writing asynchronous I/O backed applications. It is used for implementing networking clients and servers.

Tokio uses the futures crate as a foundation to build on, providing networking types and other utilities needed for building a production ready application.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in tokio by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Description
A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
Readme MIT 75 MiB
Languages
Rust 100%