I has two channels to read:
let (stat_tx, mut stat_rx) = tokio::sync::mpsc::channel(10);
let (main_tx, mut main_rx) = tokio::sync::mpsc::channel(1_000);
I want read from stat_rx
and main_rx
until main_rx.recv()
return None.
And I can not understand what if stat_rx.recv()
return None before main channel return None, how tokio::select!
handle it?
loop {
tokio::select! {
stat = stat_rx.recv() => {
if let Some(something) = stat {
//handle statistic
}
}
Some(res) = main_rx.recv() => {
// handle event from main channel
}
else => break,
}
}
when stat_rx.recv()
return None, tokio
stops poll stat_rx
or may be it execute else
branch?