Skip to content
Discussion options

You must be logged in to vote

The Endpoint has internal state tracking pending transfers, so I made it take &mut so that if it is single-owner it doesn't have to pay the cost of synchronization. Typically, it would be owned by a single thread or async task, but if you need to share it you can wrap it in a Mutex. It is not extremely expensive to create an Endpoint, but not intended to be re-created every time you submit a transfer. The big problem with that pattern would be that dropping an Endpoint cancels all of its pending transfers.

If you were using Queue on v0.1 (and you should be for a SDR, to submit multiple transfers to avoid underflow/overflow in gaps between transfers), Queue is effectively now called Endpoint.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ratzrattillo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants