#[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: SpscVarQueueThe SPSC variable-length message queue.
should_deallocate: AtomicBoolFlag 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: usizeNumber of valid bytes in name.
Implementations§
Source§impl ThreadBuffer
impl ThreadBuffer
Sourcepub fn new_on_heap() -> *mut Self
pub fn new_on_heap() -> *mut Self
Allocates a zero-initialized ThreadBuffer on the heap.
Sourcepub unsafe fn free_on_heap(pointer: *mut Self)
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.
Sourcepub fn set_name(&mut self, thread_name: &str)
pub fn set_name(&mut self, thread_name: &str)
Sets the thread name, truncated to the buffer capacity (32 bytes).
Sourcepub fn name_bytes(&self) -> &[u8] ⓘ
pub fn name_bytes(&self) -> &[u8] ⓘ
Returns the thread name as a byte slice.
Trait Implementations§
impl Send for ThreadBuffer
Auto Trait Implementations§
impl !Freeze for ThreadBuffer
impl RefUnwindSafe for ThreadBuffer
impl Sync for ThreadBuffer
impl Unpin for ThreadBuffer
impl UnsafeUnpin for ThreadBuffer
impl UnwindSafe for ThreadBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more