summaryrefslogtreecommitdiffstats
path: root/tokio
AgeCommit message (Collapse)Author
2020-10-12io: Rename `ReadBuf` methods (#2945)Lucio Franco
This changes `ReadBuf::add_filled` to `ReadBuf::advance` and `ReadBuf::append` to `ReadBuf::put_slice`. This is just a mechanical change. Closes #2769
2020-10-12sync: change chan `closed(&mut self)` to `closed(&self)` (#2939)Zahari Dichev
2020-10-12chore: remove use of doc_alias feature (#2944)Taiki Endo
2020-10-11net: make UCred fields private (#2936)Taiki Endo
2020-10-09sync: move broadcast error types into broadcast::error module (#2937)Taiki Endo
Refs: #2928
2020-10-09fs: future proof `File` (#2930)Carl Lerche
Changes inherent methods to take `&self` instead of `&mut self`. This brings the API in line with `std`. This patch is implemented by using a `tokio::sync::Mutex` to guard the internal `File` state. This is not an ideal implementation strategy doesn't make a big impact compared to having to dispatch operations to a background thread followed by a blocking syscall. In the future, the implementation can be improved as we explore async file-system APIs provided by the operating-system (iocp / io_uring). Closes #2927
2020-10-09net: switch socket methods to &self (#2934)Carl Lerche
Switches various socket methods from &mut self to &self. This uses the intrusive waker infrastructure to handle multiple waiters. Refs: #2928
2020-10-09io: make Seek and Copy private (#2935)Taiki Endo
Refs: #2928
2020-10-08time: rename `Delay` future to `Sleep` (#2932)Juan Alvarez
2020-10-08chore: Fix clippy lints (#2931)bdonlan
Closes: #2929 Co-authored-by: Bryan Donlan <bdonlan@amazon.com>
2020-10-08net: use &self with TcpListener::accept (#2919)Carl Lerche
Uses the infrastructure added by #2828 to enable switching `TcpListener::accept` to use `&self`. This also switches `poll_accept` to use `&self`. While doing introduces a hazard, `poll_*` style functions are considered low-level. Most users will use the `async fn` variants which are more misuse-resistant. TcpListener::incoming() is temporarily removed as it has the same problem as `TcpSocket::by_ref()` and will be implemented later.
2020-10-08fs: add os::windows::OpenOptionsExt (#2923)Taiki Endo
2020-10-08io: remove Poll from the AsyncSeek::start_seek return value (#2885)Zahari Dichev
2020-10-07net: add `TcpSocket` for configuring a socket (#2920)Carl Lerche
This enables the caller to configure the socket and to explicitly bind the socket before converting it to a `TcpStream` or `TcpListener`. Closes: #2902
2020-10-08fs: switch to our own DirEntryExt trait (#2921)Taiki Endo
2020-10-06docs: more docs for UdpSocket (#2883)Evan Cameron
2020-10-06time: clean time driver (#2905)greenwoodcm
* remove unnecessary wheel::Poll the timer wheel uses the `wheel::Poll` struct as input when advancing the timer to the next time step. the `Poll` struct contains an instant representing the time step to advance to and also contains an optional and mutable reference to an `Expiration` struct. from what I can tell, the latter field is only used in the context of polling the wheel and does not need to be exposed outside of that method. without the expiration field the `Poll` struct is nothing more than a wrapper around the instant being polled. this change removes the `Poll` struct and updates integration points accordingly. * remove Stack trait in favor of concrete Stack implementation * remove timer Registration struct
2020-10-06process: add ProcessDriver to handle orphan reaping (#2907)Ivan Petkov
2020-10-05time: move DelayQueue to tokio-util (#2897)bdonlan
This change is intended to do the minimum to unblock 0.3; as such, for now, we duplicate the internal `time::wheel` structures in tokio-util, rather than trying to refactor things at this stage. Co-authored-by: Bryan Donlan <bdonlan@amazon.com>
2020-10-06io, stream: assert !Unpin for ext trait futures (#2913)Taiki Endo
2020-10-05stream: remove bytes from public API (#2908)Alice Ryhl
2020-10-05io, stream: make ext trait futures !Unpin (#2910)Taiki Endo
Make these future `!Unpin` for compatibility with async trait methods.
2020-10-05net: implement AsRawSocket on Windows (#2911)Taiki Endo
2020-10-05sync: broadcast channel API tweaks (#2898)Alice Ryhl
Removes deprecated APIs and makes some small breaking changes.
2020-10-05io: optimize writing large buffers to windows stdio (#2888)Mikail Bagishov
2020-10-05fs: seal OpenOptionsExt and DirBuilderExt (#2909)Taiki Endo
2020-10-02io: update to Mio 0.7 (#2893)Carl Lerche
This also makes Mio an implementation detail, removing it from the public API. This is based on #1767.
2020-10-01chore: make #[doc(hidden)] apis private (#2901)Alice Ryhl
2020-10-02task: remove deprecated JoinError constructors (#2900)Alice Ryhl
2020-10-02Fix new clippy warning (#2899)Alice Ryhl
2020-10-01time: introduce `sleep` and `sleep_until` functions (#2826)Juan Alvarez
2020-09-29Seal FromStream methods with an internal argument (#2894)Sean McArthur
2020-09-29stream: add iter and iter_mut methods to StreamMap (#2890)Linus Behrbohm
2020-09-28Seal ToSocketAddrs methods with an internal argument (#2892)Sean McArthur
Closes #2891
2020-09-28sync: Add `is_closed` method to mpsc senders (#2726)Mikail Bagishov
Co-authored-by: Alice Ryhl <alice@ryhl.io>
2020-09-25Fix readiness future eagerly consuming entire socket readiness (#2887)Sean McArthur
In the `readiness` future, before inserting a waiter into the list, the current socket readiness is eagerly checked. However, it would return as a `ReadyEvent` the entire socket readiness, instead of just the interest desired from `readiness(interest)`. This would result in the later call to `clear_readiness(event)` removing all of it. Closes #2886
2020-09-25sync: add `mpsc::Sender::closed` future (#2840)Zahari Dichev
Adding closed future, makes it possible to select over closed and some other work, so that the task is woken when the channel is closed and can proactively cancel itself. Added a mpsc::Sender::closed future that will become ready when the receiver is closed.
2020-09-25chore: handle std `Mutex` poisoning in a shim (#2872)Zahari Dichev
As tokio does not rely on poisoning, we can avoid always unwrapping when locking by handling the `PoisonError` in the Mutex shim. Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
2020-09-24sync: support mpsc send with `&self` (#2861)Carl Lerche
Updates the mpsc channel to use the intrusive waker based sempahore. This enables using `Sender` with `&self`. Instead of using `Sender::poll_ready` to ensure capacity and updating the `Sender` state, `async fn Sender::reserve()` is added. This function returns a `Permit` value representing the reserved capacity. Fixes: #2637 Refs: #2718 (intrusive waiters)
2020-09-24io: remove poll_{read,write}_buf from traits (#2882)Carl Lerche
These functions have object safety issues. It also has been decided to avoid vectored operations on the I/O traits. A later PR will bring back vectored operations on specific types that support them. Refs: #2879, #2716
2020-09-24chore: Use IoSlice's Copy impl to clean up some repetitive code (#2875)bdonlan
As we go into 0.3 we no longer need to support older versions of Rust where IoSlice did not implement Copy and Clone, so we can more easily initialize the IoSlice array in net::tcp::stream. Co-authored-by: Bryan Donlan <bdonlan@amazon.com>
2020-09-24chore: remove internal io-driver cargo feature (#2881)Ivan Petkov
2020-09-24chore: remove internal io-readiness cargo feature (#2878)Ivan Petkov
2020-09-24process: do not publicly turn on `signal` when enabled (#2871)Ivan Petkov
This change will still internally compile any `signal` resources required when `process` is enabled on unix systems, but it will not publicly turn on the cargo feature
2020-09-24rt: Allow concurrent `Shell:block_on` calls (#2868)Lucio Franco
2020-09-24docs: use #[doc(no_inline)] on re-exports (#2874)Taiki Endo
2020-09-23io: use intrusive wait list for I/O driver (#2828)Sean McArthur
This refactors I/O registration in a few ways: - Cleans up the cached readiness in `PollEvented`. This cache used to be helpful when readiness was a linked list of `*mut Node`s in `Registration`. Previous refactors have turned `Registration` into just an `AtomicUsize` holding the current readiness, so the cache is just extra work and complexity. Gone. - Polling the `Registration` for readiness now gives a `ReadyEvent`, which includes the driver tick. This event must be passed back into `clear_readiness`, so that the readiness is only cleared from `Registration` if the tick hasn't changed. Previously, it was possible to clear the readiness even though another thread had *just* polled the driver and found the socket ready again. - Registration now also contains an `async fn readiness`, which stores wakers in an instrusive linked list. This allows an unbounded number of tasks to register for readiness (previously, only 1 per direction (read and write)). By using the intrusive linked list, there is no concern of leaking the storage of the wakers, since they are stored inside the `async fn` and released when the future is dropped. - Registration retains a `poll_readiness(Direction)` method, to support `AsyncRead` and `AsyncWrite`. They aren't able to use `async fn`s, and so there are 2 reserved slots for those methods. - IO types where it makes sense to have multiple tasks waiting on them now take advantage of this new `async fn readiness`, such as `UdpSocket` and `UnixDatagram`. Additionally, this makes the `io-driver` "feature" internal-only (no longer documented, not part of public API), and adds a second internal-only feature, `io-readiness`, to group together linked list part of registration that is only used by some of the IO types. After a bit of discussion, changing stream-based transports (like `TcpStream`) to have `async fn read(&self)` is punted, since that is likely too easy of a footgun to activate. Refs: #2779, #2728
2020-09-23rt: Allow concurrent `block_on`'s with basic_scheduler (#2804)Lucio Franco
2020-09-23sync: add `get_mut()` for `Mutex,RwLock` (#2856)Daniel Henry-Mantilla
2020-09-23net: change `UnixListener::poll_accept` to public (#2845)kalcutter