Replies: 2 comments
-
There was some discussion on this topic here. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think FuturesUnordered based on linked list is too complicated, we can simply use Lock + Queue instead, and sometimes it has good performance. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is not directly related to Tokio, was not getting responses in the users forum and someone requested asking here. As mentioned in that thread, if there is a more appropriate place to ask, please feel free to redirect. The below text is just just reproducing original text from that post:
Trying to understand how FuturesUnordered works. Getting tripped up with how the
ready_to_run_queue
interacts with linked list. Specifically, confused bypending_next_all
,spin_next_all
,link
, andunlink
. Does anyone have a good reference as to how this works? Specific questions include:The docs mention under heavy thread contention, a compare-exchange loop could become costly. What does thread contention mean here?
How does using
stub
resolve this? Confused as to how usingpending_next_all
allowsnext_all
as needed for iterator. When will there be a case where head_all -> stub -> next?More generally, would love an explanation about how
ready_to_run_queue
works withhead_all
,next_all
pointers andstub
. Particularly for the impl Stream blockBeta Was this translation helpful? Give feedback.
All reactions