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

sync: add mpsc::Receiver::blocking_recv_many #6867

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

barafael
Copy link
Contributor

Fixes: #6865

Motivation

I would like to use an API like recv_many, but from a blocking context.

Solution

Use crate::future::block_on in a similar fashion to how blocking_recv does it to call the async recv_many function.

What's missing

Tests and docs. I'll complete them once it's clear if this entire change makes sense. Do you think referring to blocking_recv and recv_many from the docs is fine or should there be more specific docs?

@github-actions github-actions bot added the R-loom-sync Run loom sync tests on this PR label Sep 24, 2024
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-sync Module: tokio/sync labels Oct 17, 2024
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@Darksonn Darksonn merged commit 1656d8e into tokio-rs:master Oct 17, 2024
90 of 91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-sync Module: tokio/sync R-loom-sync Run loom sync tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mpsc::Receiver::blocking_recv_many: Blocking variant of recv_many
2 participants