You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tbu- opened this issue
May 11, 2022
· 4 comments
· Fixed by #4901
Labels
A-tokioArea: The main tokio crateC-bugCategory: This is a bug.M-macrosModule: macros in the main Tokio crateM-taskModule: tokio/taskT-docsTopic: documentation
Well, cancelling something is done by dropping it, so once you've "cancelled" the JoinHandle, you don't have it anymore. It should say what happens when you drop it. On the other hand, if you use a mutable reference to the join handle in the select, then it isn't actually being cancelled at all.
Can you explain why it is not planned? The documentation of select! tells me that I need to be careful about using it with futures, that I need to determine whether they're cancellation safe. It lists a few futures, but JoinHandle isn't one of them. How should I, as a user, determine whether it (or a mutable reference to it) is cancellation safe?
Cancellation safety does not apply to JoinHandle at all because if you cancel it, the JoinHandle is lost and you cannot use it again. Anyway, I suppose it would be good to explain the situation in the docs regardless, so I have reopened the issue.
A-tokioArea: The main tokio crateC-bugCategory: This is a bug.M-macrosModule: macros in the main Tokio crateM-taskModule: tokio/taskT-docsTopic: documentation
Neither in the documentation of
JoinHandle
nor in the "Cancellation safety" of theselect!
macro.The text was updated successfully, but these errors were encountered: