Commit Graph
543 Commits
Author SHA1 Message Date
Sean McArthur b7f4e337be set Runtime thread pool name prefix (#232) 2018-03-15 16:37:32 -07:00
Hiroaki Nakamura d1046db735 Fix condition for updating the current date buffer (#230) 2018-03-15 09:29:55 -07:00
Sam Rijs 923a80e098 Move tokio::net module into tokio tcp/udp crates (#224) 2018-03-14 09:38:59 -07:00
Carl Lerche 64435f5b35 Travis: Move before_deploy out of matrix block (#229) 2018-03-13 15:58:53 -07:00
Aaron Turon d304791c0e Simultaneous futures compat (#172)
This patch adds opt-in support for futures 0.2.
2018-03-13 13:57:35 -07:00
Carl Lerche 5846b3fc2a Reduce AtomicTask spurious notifications (#227) 2018-03-13 13:28:41 -07:00
Carl Lerche 8eb3e58b7d Shutdown the runtime on drop (#214)
Currently, the runtime does not shutdown if the runtime handle is
dropped. This can happen during a panic or when the value is simply
dropped.

This patch forces the runtime to shutdown if it is not explicitly
shutdown.

Fixes #209
2018-03-13 13:14:51 -07:00
Carl Lerche c0a2cc1f9e Add LICENSE file to all sub crates (#226)
* Add LICENSE file to all sub crates
* Update links in README
2018-03-13 13:14:28 -07:00
Carl Lerche 61b2889881 Try compiling Tokio on FreeBSD (#228) 2018-03-13 13:14:12 -07:00
hcpl 5dab821b29 Fix docs markup (#225) 2018-03-13 11:43:05 -07:00
Wesley Moore 2abeff01a5 Fix build on FreeBSD (#218) 2018-03-13 11:24:17 -07:00
Carl Lerche 96a542451d Handle futures that panic on a threadpool (#216)
If a future panics from within the context of a thread pool, the pool
should not be impacted. To do this, polling the future is wrapped with a
catch_unwind. Extra care is taken to ensure that `thread::panicking()`
is set from within the future's drop handle.

Fixes #209
2018-03-13 09:44:14 -07:00
Gray Olson 95899e007d Update comment in udp-codec example (#222) 2018-03-12 10:39:32 -07:00
Jeehoon Kang e6e3c49e0e Remove uses of futures_cpupool (#220) 2018-03-11 11:37:10 -07:00
Carl Lerche 4d514b7eb3 Relicense Tokio exclusively under the MIT license. (#215)
This patch relicenses the Tokio project exclusively under the MIT
license. Before this, the project was dual licensed under MIT and Apache
2. As such, switching to only MIT is permitted.

Fixes #202
2018-03-09 20:07:09 -08:00
Tosil Velkov 2a1585157e Fix wrong file link in examples readme.md (#208) 2018-03-09 12:26:09 -08:00
Igor Gnatenko 189d6baac4 tokio-threadpool: bump rand to 0.4 (#205) 2018-03-09 12:25:38 -08:00
Igor Gnatenko 3ad27e99ec tokio-reactor: bump mio to 0.6.14 (#204)
With 0.6.13 it doesn't compile:
no method named `as_usize` found for type `mio::Ready` in the current scope
2018-03-09 12:25:16 -08:00
Carl Lerche bf1305c421 Bump version to v0.1.3 (#213) tokio-0.1.3 2018-03-09 11:41:31 -08:00
Carl Lerche cf7435ba30 CurrentThread::turn should block on idle. (#212)
This patch fixes a bug where `CurrentThread::turn` is expected to block
even if the executor is idle.

The `turn` API is the low level interface for callers to interact with
the `Sleep` instance used by the `CurrentThread` instance. As such, a
call to `turn` is expected to call `sleep` once if the executor did not
perform any work.
2018-03-09 11:09:10 -08:00
Carl Lerche e18c23afa1 Bump tokio to v0.1.2 (#201)
This also bumps tokio-io to v0.1.6 and prepares for the initial release
of tokio-executor, tokio-reactor, and tokio-threadpool.
tokio-threadpool-0.1.0 tokio-io-0.1.6 tokio-executor-0.1.0 tokio-reactor-0.1.0 tokio-0.1.2
2018-03-08 20:15:51 -08:00
Carl Lerche bb9de276ae Add an explicit spawn fn to TaskExecutor (#200) 2018-03-08 14:54:31 -08:00
Carl Lerche fed4d72eff Improve the chat example, making it more robust (#199)
This handles cases where clients send large amounts of data while on
localhost.

Closes #192
2018-03-08 13:38:52 -08:00
Carl Lerche 142bd3b2a9 Depend on latest release of Mio (#198) 2018-03-08 13:36:54 -08:00
Jake Goulding 7da5603a42 Remove premature French translation of "current" (#197) 2018-03-08 08:48:46 -08:00
Carl Lerche 264fef60e3 Update readme (#196) 2018-03-07 22:28:01 -08:00
Carl Lerche 25dd54d263 Improve poll_read_ready implementation (#193)
This patch updates `poll_read_ready` to take a `mask` argument, enabling
the caller to specify the desired readiness. `need_read` is renamed to
`clear_read_ready` and also takes a mask.

This enables a caller to listen for HUP events without requiring reading
from the I/O resource.
2018-03-07 16:24:51 -08:00
Carl Lerche 5555cbc85e Shutdown the thread pool on drop. (#190)
Currently, if a thread pool instance is dropped without being shutdown,
the workers will run indefinitely. This is not ideal as it leaks the
threadpool.

This patch forces the thread pool to shutdown on drop.

Closes #151
2018-03-06 21:33:45 -08:00
Carl Lerche c769b915b7 Explicitly deregister I/O resources on drop (#189)
Mio will be requiring `deregister` to be called explicitly in order to
guarantee that Poll releases any state associated with the I/O resource.
See carllerche/mio#753.

This patch adds an explicit `deregister` function to `Registration` and
updates `PollEvented` to call this function on drop.

`Registration::deregister` is also called on `PollEvented::into_inner`.

Closes #168
2018-03-06 14:40:20 -08:00
Carl Lerche 1f91a890b4 Fix benches (#188)
Some of the benchhmarks were broken and/or using deprecated APIs. This
patch updates the benches and requires them all to compile without
warnings in order to pass CI.
2018-03-06 14:40:09 -08:00
Carl Lerche 869615f1d2 Fix some comments in the examples. (#187)
The PR that updated the examples skipped some comments. This patch
updates thhe comments.
2018-03-06 12:00:49 -08:00
Colin Rofls ae20270d00 Fixup docs for AllowStdIo (#184) 2018-03-06 10:41:24 -08:00
Carl Lerche f1cb12e14f Update examples to track latest Tokio changes (#180)
The exampes included in the repository have lagged behind the changes
made. Specifically, they do not use the new runtime construct.

This patch updates examples to use the latest features of Tokio.
2018-03-06 09:59:04 -08:00
Roman 56c5797872 Split net::udp code into files: (#183)
- UdpSocket -> src/net/udp/socket.rs
- SendDgram -> src/net/udp/send_dgram.rs
- RecvDgram -> src/net/udp/recv_dgram.rs
2018-03-06 09:53:23 -08:00
Jeehoon Kang aa4b1b4311 Replace coco with crossbeam (#185) 2018-03-06 09:49:01 -08:00
Roman 687871d3e5 Split net::tcp code into files: (#177)
- Incoming -> src/net/tcp/incoming.rs
- TcpListener -> src/net/tcp/listener.rs
- TcpStream, ConnectFuture -> src/net/tcp/stream.rs
2018-03-05 12:44:09 -08:00
Philip Munksgaard 071d8704ce Fix typos (#176) 2018-03-05 11:12:43 -08:00
Carl Lerche 9f7a98af3c Switch TCP/UDP fns to poll_ -> Poll<...> style (#175)
Tokio is moving away from using `WouldBlock`, instead favoring
`Async::NotReady`.

This patch updates the TCP and UDP types, deprecating any function that
returns `WouldBlock` and adding a poll_ prefixed equivalent.
2018-03-04 10:46:54 -08:00
Carl Lerche 7db7719419 Tweak the tokio::spawn function (#171)
Currently, `tokio::spawn` matched the `spawn` function from futures 0.2.
However, this adds additional ergonomic overhead and removes the ability
to spawn from a drop fn. See rust-lang-nursery/futures-rs#830.

This patch switches the behavior to access the thread-local variable
referencing the default executor directly in the `spawn` function.
2018-03-02 15:45:35 -08:00
Carl Lerche 21c0f3a9d8 Add AsyncRead::poll_read, AsyncWrite::poll_write. (#170)
This removes the need for the `try_nb` macro as well as bring the traits
closer in line with the planed 0.2 iteration.
2018-03-02 15:15:05 -08:00
Carl Lerche e1b3085153 Extract the reactor to a dedicated crate. (#169)
This allows libraries that require access to reactor related types to
depend on this crate without having to depend on the entirety of Tokio.

For example, libraries that implement their custom I/O resource will
need to access `Registration` or `PollEvented`.
2018-03-02 13:51:34 -08:00
Carl Lerche df6e24255b Fix deprecation warnings in tests (#167) 2018-03-01 21:50:07 -08:00
Carl Lerche df19119c0a Add io facade and update reactor docs (#166)
This patch updates the documentation for a number of APIs. It also
introduces a prelude module and an io facade module, re-exporting types
from tokio-io.
2018-03-01 21:48:18 -08:00
Carl Lerche 164ee8f106 Update the README (#164) 2018-02-28 15:03:45 -08:00
Carl Lerche 7238cfa5e2 Update AppVeyor badge URL (#163) 2018-02-28 13:48:08 -08:00
Carl Lerche 7de749b77b Provide a handle to Runtime's executor. (#162)
Sometimes, passing ownership to an executor is necessary. For example,
some libraries require taking ownership of one.

This patch adds a function that returns an executor associated with a
runtime.
2018-02-28 09:07:14 -08:00
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
Roman 1190176be7 Improve current thread tests (#161)
* Create variables as closer as possible to their usage
* Check that no message is lost in test current_thread::hammer_turn
2018-02-28 09:00:25 -08:00
Carl Lerche 8e1a9101f0 Support current_thread::spawn from task drop (#157)
Currently, the thread-local tracking the current thread executor is not
set when a task is dropped. This means that one cannot spawn a new
future from within the drop implementation of another future.

This patch adds support for this by setting the thread-local before
releasing a task.

This implementation is a bit messy. It probably could be cleaned up, but
this is being put off in favor of trying a more comprehensive
reorganization once the current thread executor is feature complete.
2018-02-27 09:56:29 -08:00
Roman 427b7325d0 Update badges in README (#159) 2018-02-27 09:35:50 -08:00