Struct abi::bbqueue_ipc::bbbuffer::BBBuffer
source · #[repr(C)]pub struct BBBuffer {
buf: AtomicPtr<u8>,
buf_len: AtomicUsize,
write: AtomicUsize,
read: AtomicUsize,
last: AtomicUsize,
reserve: AtomicUsize,
read_in_progress: AtomicBool,
write_in_progress: AtomicBool,
}
Expand description
A backing structure for a BBQueue. Can be used to create either a BBQueue or a split Producer/Consumer pair
Fields§
§buf: AtomicPtr<u8>
§buf_len: AtomicUsize
§write: AtomicUsize
Where the next byte will be written
read: AtomicUsize
Where the next byte will be read from
last: AtomicUsize
Used in the inverted case to mark the end of the readable streak. Otherwise will == sizeof::<self.buf>(). Writer is responsible for placing this at the correct place when entering an inverted condition, and Reader is responsible for moving it back to sizeof::<self.buf>() when exiting the inverted condition
reserve: AtomicUsize
Used by the Writer to remember what bytes are currently allowed to be written to, but are not yet ready to be read from
read_in_progress: AtomicBool
Is there an active read grant?
write_in_progress: AtomicBool
Is there an active write grant?
Implementations§
source§impl<'a> BBBuffer
impl<'a> BBBuffer
pub unsafe fn initialize(&'a self, buf_start: *mut u8, buf_len: usize)
pub unsafe fn take_producer(me: *mut Self) -> Producer<'static>
pub unsafe fn take_consumer(me: *mut Self) -> Consumer<'static>
pub unsafe fn take_framed_producer(me: *mut Self) -> FrameProducer<'static>
pub unsafe fn take_framed_consumer(me: *mut Self) -> FrameConsumer<'static>
source§impl BBBuffer
impl BBBuffer
sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new constant inner portion of a BBBuffer
.
NOTE: This is only necessary to use when creating a BBBuffer
at static
scope, and is generally never used directly. This process is necessary to
work around current limitations in const fn
, and will be replaced in
the future.