Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rust tokio::sync::mpsc::channel is_empty() returning false when len() returns 0

I have a tokio::sync::mpsc::channel open and the receiver's is_empty() method is returning false when len() method is returning 0. This only happens after 32 loops. Weird. Anyone have ideas on why this might be happening?

like image 384
Daniel O'Leary Avatar asked Dec 31 '25 06:12

Daniel O'Leary


1 Answers

This is a bug, I have opened an issue on the tokio project.

Like I said there, channels internally use blocks of 32 values, so this may explain why this happens every 32 sends.

Edit: a correction has already been posted

like image 160
Sibear Jo Avatar answered Jan 04 '26 11:01

Sibear Jo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!