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 timing at which messages sent to a channel are Dropped #5490

Closed
fulmicoton opened this issue Feb 21, 2023 · 3 comments
Closed
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-sync Module: tokio/sync

Comments

@fulmicoton
Copy link

fulmicoton commented Feb 21, 2023

When sending message to a mpsc channel, messages seem dropped when the Receiver is dropped.

This seems like the most natural behavior, but this is not "goes without saying" situation.
Some alternative library like flume for instance, require all Senders to also be dropped for messages to be dropped.

It would be nice, if this behavior is confirmed, to add that information in the documentation.

@fulmicoton fulmicoton added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Feb 21, 2023
@fulmicoton fulmicoton changed the title Document the messages sent to a channel are Dropped Document the timing at which messages sent to a channel are Dropped Feb 21, 2023
@Darksonn Darksonn added the M-sync Module: tokio/sync label Feb 21, 2023
hds added a commit that referenced this issue Feb 22, 2023
Some users mentioned that the behavior of a channel when the receivers
and/or senders are dropped isn't explicitly documented.

This change adds wording to the documentation for each channel in the
sync module, explaining under which conditions messages in a channel are
dropped with respect to dropping the senders and the receivers.

Refs: #5490
@hds
Copy link
Contributor

hds commented Feb 23, 2023

@fulmicoton I've made some changes to the documentation in the attached PR. Do you think this would have been sufficient if you'd found it during your initial search?

@fulmicoton
Copy link
Author

@hds yes thank you!

hds added a commit that referenced this issue Feb 23, 2023
Some users mentioned that the behavior of a channel when the receivers
and/or senders are dropped isn't explicitly documented.

This change adds wording to the documentation for each channel in the
sync module, explaining under which conditions messages in a channel are
dropped with respect to dropping the senders and the receivers.

Refs: #5490
@hds
Copy link
Contributor

hds commented Feb 23, 2023

Great, I'll close the issue then.

@hds hds closed this as completed Feb 23, 2023
amab8901 pushed a commit to amab8901/tokio that referenced this issue Feb 27, 2023
Some users mentioned that the behavior of a channel when the receivers
and/or senders are dropped isn't explicitly documented.

This change adds wording to the documentation for each channel in the
sync module, explaining under which conditions messages in a channel are
dropped with respect to dropping the senders and the receivers.

Refs: tokio-rs#5490
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-sync Module: tokio/sync
Projects
None yet
Development

No branches or pull requests

3 participants