2416 Commits

Author SHA1 Message Date
Sean McArthur
be9fdb697d
time: make Interval::poll_tick() public (#3316) 2020-12-22 12:31:14 -08:00
Carl Lerche
2ee9520d10
fs: misc small API tweaks (#3315) 2020-12-22 11:13:41 -08:00
Carlos B
7d28e4cdbb
examples: add futures executor threadpool (#3198) 2020-12-22 20:08:43 +01:00
Alice Ryhl
0b83b3b8cc
fs,sync: expose poll_ fns on misc types (#3308)
Includes methods on:

* fs::DirEntry
* io::Lines
* io::Split
* sync::mpsc::Receiver
* sync::misc::UnboundedReceiver
2020-12-22 09:28:14 -08:00
Alice Ryhl
f95ad18980
net: clarify when wakeups are sent (#3310) 2020-12-22 07:38:14 -08:00
Taiki Endo
eee3ca65d6
deps: update rand to 0.8, loom to 0.4 (#3307) 2020-12-22 10:28:35 +01:00
Alice Ryhl
564c943309
io: rename AsyncFd::with_io() and rm with_poll() (#3306) 2020-12-21 15:42:38 -08:00
Bhargav
c7671a0384
io: add _mut variants of methods on AsyncFd (#3304)
Co-authored-by: Alice Ryhl <alice@ryhl.io>
2020-12-21 22:51:28 +01:00
Carl Lerche
2893359988
chore: update to bytes 1.0 git branch (#3301)
Updates the code base to track the `bytes` git branch. This is in
preparation for the 1.0 release.

Closes #3058
2020-12-19 15:57:16 -08:00
Carl Lerche
5e5f513542
chore: remove some left over stream feature code (#3300)
Removes the `stream` feature flag from `Cargo.toml` and removes the
`futures-core` dependency. Once `Stream` lands in `std`, a feature flag
is most likely not needed.
2020-12-19 14:15:00 -08:00
Arve Knudsen
1b70507894
net: remove {Tcp,Unix}Stream::shutdown() (#3298)
`shutdown()` on `AsyncWrite` performs a TCP shutdown. This avoids method
conflicts.

Closes #3294
2020-12-19 12:17:52 -08:00
Alice Ryhl
78f2340d25
tokio: remove prelude (#3299)
Closes: #3257
2020-12-19 11:42:24 -08:00
Florian Hübsch
e41e6cddbb
docs: tokio::main macro is also supported on rt (#3243)
Fixes: #3144
Refs: #2225
2020-12-19 19:12:08 +01:00
Lucio Franco
b99b00eb30
rt: change max_threads to max_blocking_threads (#3287)
Fixes #2802
2020-12-19 08:04:04 -08:00
Alice Ryhl
d948ccedfc
chore: fix stress test (#3297) 2020-12-19 12:11:10 +01:00
Alice Ryhl
3ecaf9fd9a
codec: write documentation for codec (#3283)
Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
2020-12-18 21:32:27 +01:00
Carl Lerche
abd4c00255
time: enforce current_thread rt for time::pause (#3289)
Pausing time is a capability added to assist with testing Tokio code
dependent on time. Currently, the capability implicitly requires the
current_thread runtime.

This change enforces the requirement by panicking if called from a
multi-threaded runtime.
2020-12-17 15:37:08 -08:00
Lucio Franco
c5861ef62f
docs: Add more comprehensive stream docs (#3286)
* docs: Add more comprehensive stream docs

* Apply suggestions from code review

Co-authored-by: Alice Ryhl <alice@ryhl.io>

* Fix doc tests

Co-authored-by: Alice Ryhl <alice@ryhl.io>
2020-12-17 11:46:09 -05:00
Lucio Franco
59e4b35f49
stream: Fix a few doc issues (#3285) 2020-12-17 10:35:49 -05:00
Carl Lerche
d74d17307d
time: remove Box from Sleep (#3278)
Removes the box from `Sleep`, taking advantage of intrusive wakers. The
`Sleep` future is now `!Unpin`.

Closes #3267
2020-12-16 21:51:34 -08:00
Lucio Franco
8efa62013b
Move stream items into tokio-stream (#3277)
This change removes all references to `Stream` from
within the `tokio` crate and moves them into a new
`tokio-stream` crate. Most types have had their
`impl Stream` removed as well in-favor of their
inherent methods.

Closes #2870
2020-12-15 20:24:38 -08:00
Zahari Dichev
fcce78b33a
sync: add Semaphore::close (#3065)
## Motivation
The need to expose `Semaphore::close` as explained in #3061. 

## Solution
Expose `Semaphore::close`

Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
2020-12-15 10:22:45 -08:00
Carl Lerche
79d25b0a48
tracing: switch to unstable for 1.0. (#3266)
Enabling `tracing` integration now requires compiling with `--cfg
tokio_unstable`. Once `tracing-core` guarantees the same level of
stability as Tokio 1.0, unstable can be removed.

Closes #3258
2020-12-14 17:22:31 -08:00
Carl Lerche
3f29212cb7
fs: use cfgs on fns instead of OS ext traits (#3264)
Instead of using OS specific extension traits, OS specific methods are
moved onto the structs themselves and guarded with `cfg`. The API
documentation should highlight the function is platform specific.

Closes #2925
2020-12-14 09:29:10 -08:00
Joshua Nelson
48961fac89
Document SinkExt and other futures traits on docs.rs (#3271)
These are extremely hard to find if you don't already know they exist.
2020-12-14 10:28:36 -05:00
Carl Lerche
a7833e3007
sync: remove try_recv() from mpsc types (#3263)
The mpsc `try_recv()` functions have an issue where a sent message
happens-before a call to `try_recv()` but `try_recv()` returns `None`.
Fixing this is non-trivial, so the function is removed for 1.0. When the
bug is fixed, the function can be added back.

Closes #2020
2020-12-13 21:39:51 -08:00
Jacob O'Toole
1f862d2e95
sync: add watch::Sender::borrow() (#3269) 2020-12-13 20:46:11 -08:00
Sylvain Kerkour
9149d7bfae
docs: mention blocking thread timeout in src/lib.rs (#3253) 2020-12-13 16:24:16 +01:00
cssivision
4c55419453
net: add UnixStream readiness and non-blocking ops (#3246) 2020-12-13 16:21:11 +01:00
Aldas
f26f444f42
doc: added tracing to the feature flags section (#3254) 2020-12-13 15:26:56 +01:00
cssivision
be2cb7a5ce
net: check for false-positives in TcpStream::ready doc test (#3255) 2020-12-13 15:24:59 +01:00
Sunjay Varma
df20c162ae
sync: add blocking_recv method to UnboundedReceiver, similar to Receiver::blocking_recv (#3262) 2020-12-12 08:47:35 -08:00
Alice Ryhl
c1ec469ad2
util: add constructors to TokioContext (#3221) 2020-12-11 20:41:22 -08:00
Lucio Franco
b01b2dacf2
net: update TcpStream::poll_peek to use ReadBuf (#3259)
Closes #2987
2020-12-11 20:40:24 -08:00
Evan Cameron
68717c7efa
net: remove empty udp module (#3260) 2020-12-11 14:45:57 -05:00
Alice Ryhl
69e62ef89e
sync: make TryAcquireError public (#3250)
The [`Semaphore::try_acquire`][1] method currently returns a private error type.

[1]: https://docs.rs/tokio/0.3/tokio/sync/struct.Semaphore.html#method.try_acquire
2020-12-10 19:56:05 -08:00
Nylonicious
16c2e0983c
net: Pass SocketAddr by value (#3125) 2020-12-10 14:58:27 -05:00
Yusuke Tanaka
4b1d76ec8f
docs: fix typo in signal module documentation (#3249) 2020-12-10 08:11:45 -08:00
Clemens Koza
9646b4bce3
toml: enable test-util feature for the playground (#3224) 2020-12-10 10:39:05 +01:00
Alice Ryhl
f60860af7e
watch: fix spurious wakeup (#3234)
Co-authored-by: @tijsvd
2020-12-10 09:46:01 +01:00
cssivision
2a30e13f38
net: expose poll_* methods on UnixDatagram (#3223) 2020-12-10 08:36:43 +01:00
Nylonicious
52cd240053
task: add missing feature flags for task_local and spawn_blocking (#3237) 2020-12-09 23:49:28 +01:00
Carl Lerche
473ddaa277
chore: prepare for Tokio 1.0 work (#3238) 2020-12-09 09:42:05 -08:00
bdonlan
9706ca92a8
time: Fix race condition in timer drop (#3229)
Dropping a timer on the millisecond that it was scheduled for, when it was on
the pending list, could result in a panic previously, as we did not record the
pending-list state in cached_when.

Hopefully fixes: ZcashFoundation/zebra#1452
2020-12-08 16:42:43 -08:00
Blas Rodriguez Irizar
fc7a4b3c6e
chore: fix stress test (#3233) 2020-12-09 07:38:25 +09:00
Blas Rodriguez Irizar
e01391351b
Add stress test (#3222)
Created a simple echo TCP server that on two different runtimes that is
called from a GitHub action using Valgrind to ensure that there are
no memory leaks.

Fixes: #3022
2020-12-07 21:12:22 -08:00
bdonlan
57dffb9dfe
rt: fix deadlock in shutdown (#3228)
Previously, the runtime shutdown logic would first-hand control over all cores
to a single thread, which would sequentially shut down all tasks on the core
and then wait for them to complete.

This could deadlock when one task is waiting for a later core's task to
complete. For example, in the newly added test, we have a `block_in_place` task
that is waiting for another task to be dropped. If the latter task adds its
core to the shutdown list later than the former, we end up waiting forever for
the `block_in_place` task to complete.

Additionally, there also was a bug wherein we'd attempt to park on the parker
after shutting it down which was fixed as part of the refactors above.

This change restructures the code to bring all tasks to a halt (and do any
parking needed) before we collapse to a single thread to avoid this deadlock.

There was also an issue in which canceled tasks would not unpark the
originating thread, due to what appears to be some sort of optimization gone
wrong. This has been fixed to be much more conservative in selecting when not
to unpark the source thread (this may be too conservative; please take a look
at the changes to `release()`).

Fixes: #2789
2020-12-07 20:55:02 -08:00
Carl Lerche
62023dffe5
sync: forward port 0.2 mpsc test (#3225)
Forward ports the test included in #3215. The mpsc sempahore has been
replaced in 0.3 and does not include the bug being fixed.
2020-12-07 11:24:15 -08:00
Fuyang Liu
0707f4c192
net: add TcpStream::into_std (#3189) 2020-12-06 14:33:04 +01:00
Iban Eguia
0dbba13984
deps: replace lazy_static with once_cell (#3187) 2020-12-04 10:23:13 +01:00