Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse unresolved futures in select-in-loop #8

Conversation

j4r0u53k
Copy link
Contributor

@j4r0u53k j4r0u53k commented Mar 7, 2024

When waiting for multiple futures in select inside a loop, we want to reset only a future that got resolved in that loop iteration and let the other futures in their current state.

Failing to do so can lead to data loss, e.g. when a FrameReader is in the middle of receiving a frame and a timeout future gets resolved first, calling frame_reader.receive_frame() in next loop iteration will cause that the frame being received so far gets lost and the frame_reader will start receiving new frame.

When waiting for multiple futures in select inside a loop, we
want to reset only a future that got resolved in that loop
iteration and let the other futures in their current state.

Failing to do so can lead to data loss, e.g. when a FrameReader
is in the middle of receiving a frame and a timeout future gets
resolved first, calling `frame_reader.receive_frame()` in next
loop iteration will cause that the frame being received so far
gets lost and the frame_reader will start receiving new frame.
@fvacek fvacek merged commit c2b4e25 into silicon-heaven:master Mar 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants