Skip to content

Expose Receiver::try_recv API #579

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

Closed
faern opened this issue Nov 23, 2019 · 0 comments · Fixed by #585
Closed

Expose Receiver::try_recv API #579

faern opened this issue Nov 23, 2019 · 0 comments · Fixed by #585

Comments

@faern
Copy link

faern commented Nov 23, 2019

The current channels are not analogous to the libstd ones. A notable missing feature is Receiver::try_recv for taking an item from the channel in a non blocking fashion.

I have a service where background workers conjure fairly expensive resources (start virtual machines, all of which are identical) and they then pass handles to these via a channel. On the other end is a user facing API where access to one such resource can be requested. I want to use try_recv to get an available resource from the channel. Because if there are no resources available I want the request to fail immediately. The API should yield immediate results, and no long queues should be built up.

stevepryde added a commit to stevepryde/rustonator that referenced this issue Mar 8, 2020
See async-rs/async-std#579.
Will try switching to tokio, which does support it already.
stevepryde added a commit to stevepryde/rustonator that referenced this issue May 3, 2020
See async-rs/async-std#579.
Will try switching to tokio, which does support it already.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant