-
Notifications
You must be signed in to change notification settings - Fork 472
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
Add ArrayQueue #189
Add ArrayQueue #189
Conversation
I couldn't find where we did, but I recall that we discussed the three dimensions of the flavors of queues:
I think the circular buffer will be a good implementation for all flavors of bounded queues (as this PR suggests) and unbounded spsc/spmc queues (and also work-stealing deques). The segmented queue would be a good one for unbounded mpsc/mpmc queues, guess. So I'd like to reorganize the code/crates in such a way that all those flavors (while not every combination may be practical) are addressed in Crossbeam with appropriate implementations. So I suggest:
What do you think? |
I definitely want circular buffers in crossbeam, but they are primarily single-producer, aren't they? Correct me if I'm mistaken. This is a bounded MPMC queue and Dmitry Vyukov's implementation is (to my knowledge) the best one for this specific purpose.
I'm beginning to think that perhaps we should keep This reminds me of the difference between channels (high-level with extra features like disconnection and blocking operations) and queues (low-level and focused on raw speed). Perhaps How does that sound?
Yes, that sounds good! 👍 Although I'd personally prefer to collect all those data structures in
Yes! By the way, what's the state of |
@jeehoonkang Ping. :) |
I'm sorry, I didn't notice that its |
I'm happy with the implementation of ArrayQueue. Anyway, it's by Dmitry Vyukov! Probably my main concern here is the organization of the crates. I can see that As soon as this discussion is concluded, I'll send a PR on |
It would be great if we can do that, although the
I highly doubt it. There are two obstacles:
I think we're okay with providing just three types of queues:
This small set of queues would probably cover 99% of use cases. Oh, and I just got an idea for a good naming scheme. Note:
Similarly, our queues could be named:
I think One more additional node: While we could provide more specialized queues like SPSC queues based on Those three queue types could live in three crates. I'd be okay with |
bors r+ Thanks! |
Merge conflict |
Rebased and updated the code to match latest crossbeam-channel. bors r+ |
Merge conflict (retrying...) |
Build succeeded |
This is a port of
crossbeam-channel
's bounded queue.