summaryrefslogtreecommitdiffstats
path: root/tokio/src
AgeCommit message (Collapse)Author
2020-09-22sync: Remove readiness assertion in `watch::Receiver::changed() (#2839)Zahari Dichev
*In `watch::Receiver::changed` `Notified` was polled for the first time to ensure the waiter is registered while assuming that the first poll will always return `Pending`. It is the case however that another instance of `Notified` is dropped without receiving its notification, this "orphaned" notification can be used to satisfy another waiter without even registering it. This commit accounts for that scenario.
2020-09-21sync: fix missing notification during mpsc close (#2854)Carl Lerche
When the mpsc channel receiver closes the channel, receiving should return `None` once all in-progress sends have completed. When a sender reserves capacity, this prevents the receiver from fully shutting down. Previously, when the sender, after reserving capacity, dropped without sending a message, the receiver was not notified. This results in blocking the shutdown process until all sender handles drop. This patch adds a receiver notification when the channel is both closed and all outstanding sends have completed.
2020-09-19io: fix doc-cfg on AsyncSeekExt (#2846)Taiki Endo
2020-09-19time: remove outdated todo comment (#2848)Taiki Endo
2020-09-18process: fix some docs (#2843)Nylonicious
* fix docs for Command::status and output Co-authored-by: Alice Ryhl <alice@ryhl.io>
2020-09-17sync: fix some doc typos (#2838)Nylonicious
Fixes #2781.
2020-09-13doc: fix some links (#2834)Alice Ryhl
2020-09-12sync: add const constructors to RwLock, Notify, and Semaphore (#2833)Frank Steffahn
* Add const constructors to `RwLock`, `Notify`, and `Semaphore`. Referring to the types in `tokio::sync`. Also add `const` to `new` for the remaining atomic integers in `src/loom` and `UnsafeCell`. Builds upon previous work in #2790 Closes #2756
2020-09-12sync: add const-constructors for some sync primitives (#2790)mental
Co-authored-by: Mikail Bagishov <bagishov.mikail@yandex.ru> Co-authored-by: Eliza Weisman <eliza@buoyant.io> Co-authored-by: Alice Ryhl <alice@ryhl.io>
2020-09-11sync: tweak `watch` API (#2814)Carl Lerche
Decouples getting the latest `watch` value from receiving the change notification. The `Receiver` async method becomes `Receiver::changed()`. The latest value is obtained from `Receiver::borrow()`. The implementation is updated to use `Notify`. This requires adding `Notify::notify_waiters`. This method is generally useful but is kept private for now.
2020-09-11sync: write guard to read guard downgrading for sync::RwLock (#2733)Max Heller
2020-09-11docs: more doc fixes (#2831)Zephyr Shannon
Previous docs look like they were based on the docs for `insert_at`. Changed names of variables referred to and the explanation of when the value will be returned and under what condition it will be immediately available to make sense for a Duration argument instead of an Instant.
2020-09-09sync: document mpsc::bounded minimum buffer size (#2808)Zephyr Shannon
2020-09-09stream: module level docs for tokio::stream (#2786)xd009642
2020-09-08sync: add JoinHandle::abort (#2474)John-John Tedro
2020-09-08sync: remove rt-core from blocking_{send,recv} (#2825)Blas Rodriguez Irizar
2020-09-08io: move StreamReader and ReaderStream into tokio_util (#2788)Alice Ryhl
Co-authored-by: Mikail Bagishov <bagishov.mikail@yandex.ru> Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-09-08process: make `Child::kill` async (#2823)Ivan Petkov
* This changes the `Child::kill` to be an async method which awaits the child after sending a kill signal. This avoids leaving zombie processes on Unix platforms if the caller forgets to await the child after the kill completes * A `start_kill` method was also added on `Child` which only sends the kill signal to the child process. This allows for kill signals to be sent even outside of async contexts.
2020-09-07runtime: add custom keep_alive functionality (#2809)Blas Rodriguez Irizar
Co-authored-by: Eliza Weisman <eliza@buoyant.io> Fixes: #2585
2020-09-07sync: rename `Notify::notify()` -> `notify_one()` (#2822)Juan Alvarez
Closes: #2813
2020-09-07process: add Child::{wait,try_wait} (#2796)Ivan Petkov
* add Child::try_wait to mirror the std API * replace Future impl on Child with `.wait()` method to bring our APIs closer to those in std and it allow us to internally fuse the future so that repeated calls to `wait` result in the same value (similar to std) without forcing the caller to fuse the outer future * Also change `Child::id` to return an Option result to avoid allowing the caller to accidentally use the pid on Unix systems after the child has been reaped * Also remove deprecated Child methods
2020-09-05runtime: mention on JoinHandle that the generic parameter is the return type ↵George Malayil Philip
(#2819)
2020-09-05tokio: document missing timer panics (#2801)Blas Rodriguez Irizar
Fixes: #2696 Co-authored-by: Mikail Bagishov <bagishov.mikail@yandex.ru>
2020-09-05fs: remove File::seek (#2810)Zahari Dichev
Fixes: #1993 Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
2020-09-05runtime: improve runtime vs #[tokio::main] doc (#2820)Igor Aleksanov
2020-09-05io: add `ReadBuf::take` (#2817)Zahari Dichev
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
2020-09-02util: add `const fn` support for internal `LinkedList`. (#2805)mental
2020-09-02time: move throttle to StreamExt (#2752)Blas Rodriguez Irizar
Ref: #2727
2020-09-01sync: watch channel breaking changes (#2806)Blas Rodriguez Irizar
Fixes: #2172
2020-08-28fs: implement FromRawFd & FromRawHandle for File (#2792)Nikolai Vazquez
2020-08-27rt: Refactor `Runtime::block_on` to take `&self` (#2782)Lucio Franco
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-08-27Docs delay queue (#2793)Blas Rodriguez Irizar
2020-08-26sync: add blocking_recv and blocking_send in mpsc (#2684)xd009642
Fixes: #2629
2020-08-26sync: implement map methods of parking_lot fame (#2445)John-John Tedro
Generally, this mimics the way `MappedRwLock*Guard`s are implemented in `parking_lot`. By storing a raw pointer in the guards themselves referencing the mapped data and maintaining type invariants through `PhantomData`. I didn't try to think too much about this, so if someone has objections I'd love to hear them. I've also dropped the internal use of `ReleasingPermit`, since it made the guards unecessarily large. The number of permits that need to be released are already known by the guards themselves, and is instead governed directly in the relevant `Drop` impls. This has the benefit of making the guards as small as possible, for the non-mapped variants this means a single reference is enough. `fmt::Debug` impls have been adjusted to behave exactly like the delegating impls in `parking_lot`. `fmt::Display` impls have been added for all guard types which behave the same. This does change the format of debug impls, for which I'm not sure if we provide any guarantees.
2020-08-26sync: fix typo in Notify documentation (#2794)James Mills
2020-08-24runtime: add thread_name_fn method to runtime::Builder (#1921)wspsxing
Fixes: #1907
2020-08-23sync: move CancellationToken to tokio-util (#2721)Carl Lerche
* sync: move CancellationToken to tokio-util The `CancellationToken` utility is only available with the `tokio_unstable` flag. This was done as the API is not final, but it adds friction for users. This patch moves `CancellationToken` to tokio-util where it is generally available. The tokio-util crate does not have any constraints on breaking change releases. * fix clippy * clippy again
2020-08-23net: Add examples to UnixDatagram (#2765)caranatar
* net: adding examples for UnixDatagram Adding examples to documentation for UnixDatagram * net: document named UnixDatagrams persistence Add documentation to indicate that named UnixDatagrams 'leak' socket files after execution. * net: rustfmt issue in UnixDatagram Fixing rustfmt issue in UnixDatagram * net: adding examples for UnixDatagram Fixes: #2686 Refs: #1679 Refs: #1111
2020-08-13io: change AsyncRead to use a ReadBuf (#2758)Sean McArthur
Works towards #2716. Changes the argument to `AsyncRead::poll_read` to take a `ReadBuf` struct that safely manages writes to uninitialized memory.
2020-08-13chore: reformat some imports for consistency (#2768)Carl Lerche
2020-08-11io: rewrite slab to support compaction (#2757)Carl Lerche
The I/O driver uses a slab to store per-resource state. Doing this provides two benefits. First, allocating state is streamlined. Second, resources may be safely indexed using a `usize` type. The `usize` is used passed to the OS's selector when registering for receiving events. The original slab implementation used a `Vec` backed by `RwLock`. This primarily caused contention when reading state. This implementation also only **grew** the slab capacity but never shrank. In #1625, the slab was rewritten to use a lock-free strategy. The lock contention was removed but this implementation was still grow-only. This change adds the ability to release memory. Similar to the previous implementation, it structures the slab to use a vector of pages. This enables growing the slab without having to move any previous entries. It also adds the ability to release pages. This is done by introducing a lock when allocating/releasing slab entries. This does not impact benchmarks, primarily due to the existing implementation not being "done" and also having a lock around allocating and releasing. A `Slab::compact()` function is added. Pages are iterated. When a page is found with no slots in use, the page is freed. The `compact()` function is called occasionally by the I/O driver. Fixes #2505
2020-08-11fs: add comment explaing File flush is a no-op (#2761)Kruno Tomola Fabro
Signed-off-by: Kruno Tomola Fabro <krunotf@gmail.com>
2020-08-09io: use stderr in stderr documentation (#2746)Cameron Taggart
2020-08-09sync: typo in impl Semaphore (#2745)Blas Rodriguez Irizar
2020-08-08sync: show correct permits in fmt::Debug (#2750)Blas Rodriguez Irizar
Fixes: #2744
2020-08-07chore: prepare for v0.3 breaking changes (#2747)Carl Lerche
Bug fixes will be applied to the v0.2.x branch.
2020-08-05process: document remote killing for Child (#2736)Blas Rodriguez Irizar
* process: document remote killing for Child Fixes: #2703
2020-08-01net: impl ToSocketAddrs for (String, u16) (#2724)南浦月
2020-07-31sync: suspectible -> susceptible (#2732)Max Bruckner
2020-07-31sync: better Debug for Mutex (#2725)Mikail Bagishov