You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once a bounded channel has been filled and cleared using only try_send and try_next, it remains in a broken state. From here calling try_send always reports that the queue is full, where as try_next always reports that it is empty. This behavior is not found with std::sync::mpsc.
See the following example (0.2.0-alpha):
use futures::channel::mpsc;fnmain(){let(mut tx,mut rx) = mpsc::channel(1);println!("{:?}", tx.try_send("hello"));// Ok(())println!("{:?}", tx.try_send("hello"));// Ok(())println!("{:?}", rx.try_next());// Ok(Some("hello"))println!("{:?}", rx.try_next());// Ok(Some("hello"))println!("{:?}", tx.try_send("hello"));// Err(TrySendError { kind: Full })println!("{:?}", rx.try_next());// Err(TryRecvError)println!("{:?}", tx.try_send("hello"));// Err(TrySendError { kind: Full })println!("{:?}", rx.try_next());// Err(TryRecvError)}
The text was updated successfully, but these errors were encountered:
Fixed by moving calls to unpark_one and dec_num_messages into next_message
so that calling them cannot be missed (as it was with try_next).
Closesrust-lang#861
Once a bounded channel has been filled and cleared using only
try_send
andtry_next
, it remains in a broken state. From here callingtry_send
always reports that the queue is full, where astry_next
always reports that it is empty. This behavior is not found withstd::sync::mpsc
.See the following example (0.2.0-alpha):
The text was updated successfully, but these errors were encountered: