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

WIP heap-allocated BBBuffer #69

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

WIP heap-allocated BBBuffer #69

wants to merge 8 commits into from

Conversation

tedsta
Copy link

@tedsta tedsta commented Jul 25, 2020

Hi there,

I took a stab at #41 here. What's missing is a bbqueue::heap::FramedProducer and bbqueue::heap::FramedConsumer. Also I'm unsure of how you want to structure the crate in terms of heap vs globally-allocated/stack-allocated.

For heap-allocated framed producer/consumer, here's what I'm thinking:

  • Move framed::FramedProducer and framed::FramedConsumer into common, make them use common::Producer / common::Consumer instead of bbqueue::Producer / bbqueue::Consumer.
  • Export wrapped bbqueue::FramedProducer / bbqueue::FramedConsumer with lifetimes re-added.
  • Export wrapped heap::FramedProducer / heap::FramedConsumer with reference counter for dropping (duplicate heap::Producer / heap::Consumer dropping code.

If you like that plan I can go ahead an implement it.

I split the common code into a separate common module that has Producer<N> and Consumer<N> types without lifetimes. The bbbuffer module exports wrapped Producer<'a, N> and Consumer<'a, N> types with the lifetimes. The heap module exports wrapped Producer<N> and Consumer<N> types that include a reference counter to determine if the underlying ConstBBBuffer should be dropped when the producer/consumer is dropped.

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