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

Needless lifetimes shenanigans #81

Closed
chrysn opened this issue Feb 6, 2024 · 1 comment
Closed

Needless lifetimes shenanigans #81

chrysn opened this issue Feb 6, 2024 · 1 comment

Comments

@chrysn
Copy link
Member

chrysn commented Feb 6, 2024

See rust-embedded-community/embedded-nal#103 (comment) and responses.

@chrysn chrysn changed the title Needless lifetimes shenanigangs Needless lifetimes shenanigans Aug 16, 2024
@chrysn
Copy link
Member Author

chrysn commented Aug 20, 2024

The claim of the comment was that relying on drop to unset the callback would be unsound because drop might not be called.

In that thread, I claimed that that's not an issue because the socket is only 'static anyway (and thus created this issue assuming that the lifetime could be removed from the ReceiveIntoArgs).

Looking at it again, the trouble is not with the socket, but with the buffer that is being received into.

The more accurate description would be that the callback goes to the socket to wake the task (for which it is indeed relevant that the struct is static), but then the buffer is only written to during the polling, which only happens if the task is still active.

Thus,

  • we'd have an issue only if RIOT were to write into the buffer while the cb is set (Windows style, which would be a good thing conceptionally but RIOT doesn't work that way ATM)
  • we still do need the lifetimes because the buffer reference is indeed 'a lived.

Therefore, I think the issue should just be closed.

@chrysn chrysn closed this as completed Aug 20, 2024
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

No branches or pull requests

1 participant