jamesmunns/bbqueue

Allow taking just Producer or Consumer

jamesmunns opened this issue · 1 comments

Allow for the time-disjoint splitting of producer and consumer, allowing one context to take only the item it needs. Something like:

static BUF: BBBuffer<U8> = BBBuffer( ConstBBBuffer::new() );

fn one() {
    BUF.try_take_producer().unwrap().grant_exact(1).unwrap().commit(1);
}

fn two() {
   BUF.try_take_consumer().unwrap().read().unwrap().release(1);
}

fn main() {
    one();
    two();
}

Optionally: Dropping the producer or consumer should allow for later re-taking of the producer or consumer.