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

feat(mpsc): add waiting send/send_ref #7

Merged
merged 18 commits into from
Dec 6, 2021
Merged

feat(mpsc): add waiting send/send_ref #7

merged 18 commits into from
Dec 6, 2021

Conversation

hawkw
Copy link
Owner

@hawkw hawkw commented Dec 3, 2021

This branch adds implementations of Sender::send and
Sender::send_ref methods for the MPSC channels. This allows a sender
to wait for capacity when the channel is full, rather than returning an
error.

This took a lot of work to get working, and there were some potential
deadlocks that had to be fixed. However, it's passing all the loom tests
now (finally)!

For the blocking version, some loom tests currently fail due to an
upstream issue (tokio-rs/loom#246). However, the async versions of the
same tests (which are not effected by the loom bug) do pass, so we can
assume that it's probably correct.

Currently, the senders queue themselves to wait using a spinlock around
a VecDeque, which I don't love at all. But, this works for now, and we
can consider switching to an intrusive list strategy later.

@hawkw hawkw force-pushed the eliza/refac-mpsc branch 2 times, most recently from d436d06 to bea70a4 Compare December 4, 2021 19:57
hawkw added 8 commits December 6, 2021 10:36
(after 3667000+ iterations)

Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
this way it doesn't take 16 minutes to run

Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw marked this pull request as ready for review December 6, 2021 22:01
@hawkw hawkw merged commit 76df064 into main Dec 6, 2021
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

Successfully merging this pull request may close these issues.

1 participant