Pavel Hofman
Pavel Hofman

Reputation: 13

Sender-side deleting pending messages in mpsc channel

Please is there a way for sender to delete pending messages sent to mpsc channel (or crossbeam-channel or equivalent) which have not been consumed by the receiver yet? Something like sender.deleteAllPending().

Upvotes: 1

Views: 408

Answers (1)

Denys Séguret
Denys Séguret

Reputation: 382334

You can't do that with mspc which is "single consumer".

With crossbeam, you can have multiple receivers. So you can clone and keep a receiver "sender side", so you can drain it.

Upvotes: 1

Related Questions