336 Commits

Author SHA1 Message Date
Nikolai Kuklin
1b98d5ad85
task: add tokio_util::task::JoinQueue (#7590) 2025-09-20 15:38:59 +08:00
Martin Grigorov
86de2e306b
util: fix pending_only_on_first_poll_with_cancellation_token_owned_test to use an owned cancellation token (#7613)
The name of the test suggests that it should test the
with_cancellation_token_owned() extension method
2025-09-15 16:22:42 +09:00
Martin Grigorov
7a0ca807be
time: add #[track_caller] to FutureExt::timeout (#7588)
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
2025-09-11 09:18:40 +02:00
Martin Grigorov
de978c47e0
task: remove duplicated code in JoinMap::remove_by_id (#7603) 2025-09-10 22:16:15 +08:00
Varun Doshi
c8371d45bc
codec: add {FramedRead,FramedWrite}::into_parts() (#7566) 2025-09-03 13:38:51 +02:00
Daniel Sharifi
adc3e19ba7
time: clarify the cancellation safety of the DelayQueue (#7564) 2025-08-31 20:57:17 +08:00
Qi
11d7c0486a
task: inline the docs of TaskTracker while re-exporting it (#7516)
Signed-off-by: ADD-SP <qiqi.zhang@konghq.com>
2025-08-08 09:54:25 +02:00
Luca Bruno
ef5b6af7f6
future: clarify the fairness of FutureExt for cancellation adapters (#7512)
This fixes the docstrings on `FutureExt` so that the bias and fairness
notes are correct and consistent in all cases.
All cancellation-related wrappers are biased towards the completion of
the inner future, but they do initially check if the token is
already cancelled at construction time.
2025-08-04 21:26:11 +08:00
Conrad Ludgate
f1d3b065b6
task: fix flaky joinmap test during abort (#7509) 2025-08-03 20:00:33 +02:00
Alice Ryhl
cf6b50a3fd
chore: prepare tokio-util v0.7.16 (#7507) 2025-08-03 11:12:41 +02:00
Conrad Ludgate
416e36b0df
task: stabilise JoinMap (#7075) 2025-08-03 07:58:28 +00:00
Lucas Black
4e3f17bce3
codec: also apply capacity to read buffer in Framed::with_capacity (#7500) 2025-08-01 21:26:33 +02:00
Lucas Black
1bc50825f3
codec: add FramedWrite::with_capacity (#7493) 2025-08-01 11:23:22 +02:00
yanyuxing
0e5c5d64f5
future: add adapters of CancellationToken for FutureExt (#7475) 2025-07-29 18:09:13 +08:00
Conrad Ludgate
9e94fa7e15
task: remove raw-entry feature from hashbrown dep (#7252) 2025-07-22 15:52:54 +02:00
Stepan Tubanov
6d868d96ce
sync: fix CancellationToken failing to cancel the ready futures (#7462)
This patch fixes an issue where the `CancellationToken::run_until_cancelled` never cancels the `Future` that returns `Ready` at the first `poll`.

---------

Co-authored-by: Luca BRUNO <lucab@lucabruno.net>
2025-07-20 10:03:29 +08:00
Aaron Chen
a7896d07f1
chore: update CI to clippy 1.88 (#7452) 2025-07-09 08:34:24 +02:00
shangchenglumetro
a1ee3ef218
chore: fix some minor typos in the comments (#7442)
Signed-off-by: shangchenglumetro <shuang.cui@live.com>
2025-07-04 11:29:27 +02:00
Qi
b3a14483bf
sync: improve docs of tokio_util::sync::CancellationToken (#7408)
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
2025-06-19 06:32:41 +08:00
yanyuxing
b926700065
sync: add DropGuardRef for CancellationToken (#7407) 2025-06-18 10:25:41 +02:00
Geoffry Song
912b862a05
task: add AbortOnDropHandle::detach (#7400) 2025-06-10 09:35:48 +02:00
Suryakant Soni
a0af02a396
compat: add more documentation to tokio_util::compat (#7279) 2025-04-28 16:20:47 +02:00
Alice Ryhl
4d4d12613b
chore: prepare tokio-util v0.7.15 (#7283) 2025-04-23 13:13:48 +02:00
Conrad Ludgate
c3037adac9
task: properly handle removed entries in JoinMap (#7264) 2025-04-15 16:33:20 +02:00
Jamie
d83ba30d8d
task: explicitly state that TaskTracker does not abort tasks on Drop (#7223) 2025-03-14 14:48:54 +00:00
LongYinan
f339587b27
deps: update hashbrown to 0.15 (#7219) 2025-03-14 09:47:18 +01:00
Alice Ryhl
b663abe091 chore: update tokio-util version number (#7215) 2025-03-13 11:22:34 +01:00
Motoyuki Kimura
9a11efc262
chore: prepare tokio-util v0.7.14 (#7215) 2025-03-13 11:20:52 +01:00
Ty Larrabee
e4a39d2ef6
sync: add CancellationToken::run_until_cancelled_owned (#7081) 2025-03-10 14:24:25 +01:00
dlzht
47d46455bd
util: optimize buffer reserve for AnyDelimiterCodec::encode (#7188) 2025-03-02 19:53:19 +03:30
Josh Triplett
638ce93591
io: add read_exact_arc to safely read a new uninitialized Arc (#7165) 2025-02-27 14:07:49 +01:00
Josh Triplett
6d410f6c90
util: fix example of Buf implementor in StreamReader docs (#7167) 2025-02-21 09:22:16 +03:30
Nathaniel Bajo
aa70f6c5f0
io: add documentation for SyncIoBridge with examples and alternatives (#6815) 2025-02-16 19:01:52 +01:00
M.Amin Rayej
0a15768380
io: clean up buffer casts (#7142) 2025-02-10 19:57:25 +03:30
Oliver Wangler
5086e56dcb
io: implemented get_ref and get_mut for SyncIoBridge (#7128)
Co-authored-by: ow <oliver.wangler@helsing.ai>
2025-01-28 15:28:07 +01:00
Taiki Endo
7f09959b0a
chore: use [lints] to address unexpected_cfgs lint (#7124) 2025-01-25 17:46:21 +01:00
CMelz
b54b9d4338
codec: fix typo in API documentation (#7044) 2024-12-18 13:33:21 +01:00
Noisy
bfa8cadaa0
chore: spelling and date format Corrections (#7018) 2024-12-10 13:16:41 +01:00
Motoyuki Kimura
79a2afae9f
util: enable Either to use underlying AsyncWrite implementation (#7025) 2024-12-10 01:52:16 +09:00
tiif
eb72ddde3b
task: run spawn_pinned tests with miri (#7023) 2024-12-08 12:45:16 +01:00
Alice Ryhl
c032ea0203
ci: detect trailing whitespace (#7013) 2024-12-04 17:23:13 +01:00
Alice Ryhl
0b31c2f73d
chore: prepare tokio-util v0.7.13 (#7012) 2024-12-04 12:49:55 +01:00
Zettroke
129f9fc0c8
codec: fix incorrect handling of invalid utf-8 in LinesCodec::decode_eof (#7011) 2024-12-04 10:18:14 +00:00
David Herberth
bce9780dd3
time: use array::from_fn instead of manually creating array (#7000) 2024-12-01 19:54:30 +01:00
Hamir Mahal
d4178cf349
tokio: avoid positional fmt params when possible (#6978) 2024-11-18 13:50:58 +01:00
tiif
161b8c80d5
ci: test more things with miri (#6885) 2024-10-11 09:44:50 +02:00
Hayden Stainsby
c3a935541d
task: add task size to tracing instrumentation (#6881)
In Tokio, the futures for tasks are stored on the stack unless they are
explicitly boxed, either by the user or auto-boxed by Tokio when they
are especially large. Auto-boxing now also occurs in release mode
(since #6826).

Having very large futures can be problematic as it can cause a stack
overflow. In some cases it might be desireable to have smaller futures,
even if they are placed on the heap.

This change adds the size of the future driving an async task or the
function driving a blocking task to the tracing instrumentation. In the
case of a future that is auto-boxed by Tokio, both the final size as well
the original size before boxing is included.

To do this, a new struct `SpawnMeta` gets passed down from where a
future might get boxed to where the instrumentation is added. This
contains the task name (optionally) and the original future or function
size. If the `tokio_unstable` cfg flag and the `tracing` feature aren't both
enabled, then this struct will be zero sized, which is a small improvement
on the previous behavior of unconditionally passing down an `Option<&str>`
for the name.

This will make this information immediately available in Tokio Console,
and will enable new lints which will warn users if they have large futures
(just for async tasks).

We have some tests under the `tracing-instrumentation` crate which test
that the `size.bytes` and `original_size.bytes` fields are set correctly.

The minimal version of `tracing` required for Tokio has been bumped from
0.1.25 to 0.1.29 to get the `Value` impl on `Option<T>`. Given that the current
version is 0.1.40, this seems reasonable, especially given that Tracing's MSRV
is still lower than Tokio's in the latest version.
2024-10-08 10:51:03 +02:00
Nur
29cd6ec1ec
time: import Future trait from std instead of futures_core (#6884) 2024-10-07 14:13:09 +02:00
Motoyuki Kimura
09bc9a05e4
chore: use boxed slice if possible (#6858) 2024-09-25 19:45:28 +09:00
Eduardo Sánchez Muñoz
12b2567b95
chore: use poll_fn from std (#6810) 2024-09-05 09:54:06 +02:00