Skip to content

Cannot get a grant for the full capacity #129

Description

@szszoke

I don't seem to be able to get a grant for the full capacity of my queue. The code below panics with InsufficientSize. I am running version 0.7.0.

use bbqueue::nicknames::Churrasco;

fn main() {
    let queue = Churrasco::<1024>::new();

    let prod = queue.framed_producer();

    let mut _g = prod.grant(1024).unwrap();
}

Something also seems to be weird when grants have been committed and released a few times.

use bbqueue::nicknames::Churrasco;

fn main() {
    let queue = Churrasco::<1024>::new();

    let prod = queue.framed_producer();
    let cons = queue.framed_consumer();

    for i in 1..3 {
        println!("Iteration {}", i);
        let mut g = prod.grant(1022).unwrap();

        g[0] = 1;
        g[1] = 2;

        g.commit(2);

        cons.read().unwrap().release();
    }
}

The code above produces this output:

Iteration 1
Iteration 2

thread 'main' (376465) panicked at src/main.rs:11:38:
called `Result::unwrap()` on an `Err` value: InsufficientSize
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions