Skip to content

Does the loop + select! construct block the executor? #4468

Answered by asonix
TuhinNair asked this question in Q&A
Discussion options

You must be logged in to vote

select internally builds a poll_fn(|cx| { /* */ }) which polls each of the futures until one is ready or until all have been polled. it puts a .await on the poll_fn which yields to the executor if all the futures polled inside returned Pending, otherwise it will execute the branch associated with the ready future. You can see the code yourself with cargo-expand

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@TuhinNair
Comment options

@asonix
Comment options

Answer selected by TuhinNair
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants