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

Reintroduce std::comm::Handle.try_recv() #12219

Closed
Closed
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion src/libstd/comm/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use ptr::RawPtr;
use result::{Ok, Err, Result};
use rt::local::Local;
use rt::task::{Task, BlockedTask};
use super::Port;
use super::{Port, TryRecvResult};
use uint;

macro_rules! select {
Expand Down Expand Up @@ -249,6 +249,9 @@ impl<'port, T: Send> Handle<'port, T> {
/// success or `None` if the channel disconnects. This function has the same
/// semantics as `Port.recv_opt`
pub fn recv_opt(&mut self) -> Option<T> { self.port.recv_opt() }
/// Immediately attempt to receive a value on a port, this function will
/// never block. Has the same semantics as `Port.try_recv`.
pub fn try_recv(&mut self) -> TryRecvResult<T> { self.port.try_recv() }

/// Adds this handle to the port set that the handle was created from. This
/// method can be called multiple times, but it has no effect if `add` was
Expand Down