Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recv_many for mpsc channels #6010

Merged
merged 37 commits into from
Oct 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f13ea3e
Method recv_many returns a Vec<T> for mpsc channels
Jul 1, 2023
0133425
Update recv_many to populate a passed-in buffer.
Sep 9, 2023
7d0d8db
fix rustfmt issues
Sep 15, 2023
487f887
fix returning the result of a binding from a block
Sep 15, 2023
7086b34
fix rustfmt braces around continue
Sep 15, 2023
9a170b0
Update from bencher and merge benchmarks into sync_mpsc.rs
Sep 16, 2023
01b2270
fix Cargo.toml to reflect deletion of old benchmark
Sep 16, 2023
8c8b06f
Simplified recv_many implementation
Sep 25, 2023
dc81be3
Fix test send_recv_unbounded for arbitrarty BLOCK_CAP values
Sep 25, 2023
8f5b00c
Fix for rustfmt
Sep 25, 2023
3c1dc33
switch to break to exit loop
Sep 26, 2023
757bc33
resolve return value 0 for recv_many
Sep 27, 2023
0948857
Change to recv_many to no longer clear the output buffer
Sep 27, 2023
1dc2dbf
Filled buffer handling now fail-safe, not fail-fast
Sep 28, 2023
6bf430c
improved doctest example
Sep 30, 2023
cdc3665
fixed nested if; resolve documentation issues for recv_many
Sep 30, 2023
4c1321f
Update tokio/src/sync/mpsc/unbounded.rs
aschweig Oct 1, 2023
27ae226
Update tokio/src/sync/mpsc/unbounded.rs
aschweig Oct 1, 2023
9a1d9bc
Updated doctests to be similar; clarified documentation
Oct 1, 2023
7fca954
accomodate that with_capacity(n) gives capacity of at least n
Oct 1, 2023
fe44b32
Improved documentation for `recv_many` and added test
Oct 1, 2023
aac0eda
Update tokio/src/sync/mpsc/bounded.rs
aschweig Oct 1, 2023
088537c
Update tokio/src/sync/mpsc/bounded.rs
aschweig Oct 1, 2023
effb0e5
change recv_many doctests to use drop not scope
Oct 1, 2023
1fb08df
adopt improved wording on buffer capacity behavior
Oct 1, 2023
bd1ef3a
Only reserve if no unused capacity and there is 1+ value(s) to receive
Oct 1, 2023
d31fd17
Updated `recv_many` to accept a new argument `limit`
Oct 2, 2023
3cd2e46
rename to_go to remaining
Oct 2, 2023
326fa53
Change behavior of recv_many(buf, 0) to return 0 immediately.
Oct 8, 2023
e8950ce
Fix doc issues
Oct 8, 2023
ead4ca6
Update tokio/src/sync/mpsc/chan.rs
aschweig Oct 11, 2023
2fcb715
Update tokio/src/sync/mpsc/chan.rs
aschweig Oct 11, 2023
ba46b7c
check the coop budget in limit==0 case
Oct 11, 2023
b1d1cae
clean up some recv_many tests
Oct 11, 2023
f162ca7
Update tokio/src/sync/mpsc/bounded.rs
aschweig Oct 11, 2023
9f39dc7
Reflow doc comments; adjust comment in chan.rs
Oct 11, 2023
27e39d9
Merge branch 'master' into recv_many
Darksonn Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix rustfmt braces around continue
  • Loading branch information
Aaron Schweiger authored and aschweig committed Oct 9, 2023
commit 7086b34868e2fa66167f690d33721fa77900102b
12 changes: 6 additions & 6 deletions benches/sync_mpsc_recv_many.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn contention_bounded_updater_recv(b: &mut Bencher) {

let mut last_value = 0usize;
for _ in 0..1_000 * 5 {
let Some(v) = rx.recv().await else {continue};
let Some(v) = rx.recv().await else { continue };
last_value = v
}
last_value
Expand Down Expand Up @@ -89,7 +89,7 @@ fn contention_bounded_updater_publish_recv(b: &mut Bencher) {
}

for _ in 0..1_000 {
let Some(v) = rx.recv().await else {continue};
let Some(v) = rx.recv().await else { continue };
let _ = publish_last_value(v);
}
})
Expand Down Expand Up @@ -143,7 +143,7 @@ fn contention_bounded_full_updater_recv(b: &mut Bencher) {

let mut last_value = 0usize;
for _ in 0..1_000 * 5 {
let Some(v) = rx.recv().await else {continue};
let Some(v) = rx.recv().await else { continue };
last_value = v
}
last_value
Expand Down Expand Up @@ -200,7 +200,7 @@ fn contention_unbounded_updater_recv(b: &mut Bencher) {

let mut last_value = 0usize;
for _ in 0..1_000 * 5 {
let Some(v) = rx.recv().await else {continue};
let Some(v) = rx.recv().await else { continue };
last_value = v
}
last_value
Expand Down Expand Up @@ -252,7 +252,7 @@ fn uncontented_bounded_updater_recv(b: &mut Bencher) {

let mut last_value = 0usize;
for _ in 0..5_000 {
let Some(v) = rx.recv().await else {continue};
let Some(v) = rx.recv().await else { continue };
last_value = v
}
last_value
Expand Down Expand Up @@ -299,7 +299,7 @@ fn uncontented_unbounded_updater_recv(b: &mut Bencher) {

let mut last_value = 0usize;
for _ in 0..5_000 {
let Some(v) = rx.recv().await else {continue};
let Some(v) = rx.recv().await else { continue };
last_value = v
}
last_value
Expand Down