Skip to main content

ThreadBuffer

Struct ThreadBuffer 

Source
#[repr(C)]
pub struct ThreadBuffer { pub queue: SpscVarQueue, pub should_deallocate: AtomicBool, pub name: [u8; 32], pub name_length: usize, }
Expand description

Per-thread buffer containing an SPSC queue and thread metadata. Allocated on the heap via new_on_heap() (1MB+, too large for the stack).

Fields§

§queue: SpscVarQueue

The SPSC variable-length message queue.

§should_deallocate: AtomicBool

Flag indicating whether this buffer should be deallocated by the background poller.

§name: [u8; 32]

Thread name stored as raw UTF-8 bytes (up to 32 bytes).

§name_length: usize

Number of valid bytes in name.

Implementations§

Source§

impl ThreadBuffer

Source

pub fn new_on_heap() -> *mut Self

Allocates a zero-initialized ThreadBuffer on the heap.

Source

pub unsafe fn free_on_heap(pointer: *mut Self)

Frees a heap-allocated ThreadBuffer.

§Safety

pointer must have been returned by new_on_heap() and must only be freed once.

Source

pub fn set_name(&mut self, thread_name: &str)

Sets the thread name, truncated to the buffer capacity (32 bytes).

Source

pub fn name_bytes(&self) -> &[u8]

Returns the thread name as a byte slice.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.