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

Document the current Poll::poll timeout behaviour #1603

Merged

Conversation

Thomasdezeeuw
Copy link
Collaborator

/cc @danielparks

Closes #1600

@Thomasdezeeuw
Copy link
Collaborator Author

What do you think @danielparks?

@danielparks
Copy link

Looks good. Thanks!

@Thomasdezeeuw Thomasdezeeuw merged commit c6b5f13 into tokio-rs:master Aug 11, 2022
@Thomasdezeeuw Thomasdezeeuw deleted the issue#1600_doc_poll_timeout branch August 11, 2022 11:00
@jkarneges
Copy link

Hmm. My interpretation of the updated documentation is that mio's poll is free to return something other than Ok(()) if the call times out. Is that intentional? This would mean all apps would need to be very defensive and swallow all errors. Else apps risk crashing if a future version of mio decides to return Err on timeout.

Based on the discussion in #1600, I suspect the documentation was meant to say something like: "timeouts always return Ok(()), and a return value of Ok(()) with zero events likely indicates a timeout but is not guaranteed to be a timeout". This is quite a different claim, and would not require apps to swallow all errors.

@Thomasdezeeuw
Copy link
Collaborator Author

Hmm. My interpretation of the updated documentation is that mio's poll is free to return something other than Ok(()) if the call times out. Is that intentional? This would mean all apps would need to be very defensive and swallow all errors. Else apps risk crashing if a future version of mio decides to return Err on timeout.

Based on the discussion in #1600, I suspect the documentation was meant to say something like: "timeouts always return Ok(()), and a return value of Ok(()) with zero events likely indicates a timeout but is not guaranteed to be a timeout". This is quite a different claim, and would not require apps to swallow all errors.

This documentation intends to document that we follow whatever the OS does, we have no special handling for timeouts. At the moment that means it return Ok(()). However a new implementation might return an error on timeout, we'll have consider it when it comes up.

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.

poll()’s return on timeout not documented
4 participants