-
Notifications
You must be signed in to change notification settings - Fork 461
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
channel: Replace Spinlock with Mutex #835
Conversation
✌️ ibraheemdev can now approve this pull request. To approve and merge a pull request, simply reply with |
A better design might be to use an intrusive linked list for wakers, which could avoid allocations entirely in the critical section, but this seems like a good change either way. Thanks! |
@bors r+ |
bors r=ibraheemdev (The command of bors used in rust-lang is |
Build succeeded: |
850: Prepare for the next release r=taiki-e a=taiki-e - crossbeam-channel 0.5.4 -> 0.5.5 - Replace Spinlock with Mutex. (#835) - crossbeam-epoch 0.9.8 -> 0.9.9 - Replace lazy_static with once_cell. (#817) - crossbeam-utils 0.8.8 -> 0.8.9 - Replace lazy_static with once_cell. (#817) Co-authored-by: Taiki Endo <te316e89@gmail.com>
850: Prepare for the next release r=taiki-e a=taiki-e - crossbeam-channel 0.5.4 -> 0.5.5 - Replace Spinlock with Mutex. (#835) - crossbeam-epoch 0.9.8 -> 0.9.9 - Replace lazy_static with once_cell. (#817) - crossbeam-utils 0.8.8 -> 0.8.9 - Replace lazy_static with once_cell. (#817) Co-authored-by: Taiki Endo <te316e89@gmail.com>
close #13815 According to crossbeam-rs/crossbeam#835, spinning at the sending side is probably a bad idea because of large critical section and it's fixed in the recent version. This commit updates crossbeam-channel. It will reduce CPU usage a bit and improve performance. Signed-off-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Addresses one of @thomcc's reviews in rust-lang/rust#93563 (comment) (sorry for the late response!)
Historically, the use of spinlock was introduced when the dependency on parking_lot was removed (5208895).
However, given that it is used in Waker, which includes vectors that may be reallocated, using mutex seems to be the right choice here.
r? @ibraheemdev
bors d=ibraheemdev