Skip to main content

ThreadBuilder

Struct ThreadBuilder 

Source
pub struct ThreadBuilder { /* private fields */ }
Expand description

Resource and diagnostic configuration for one kernel thread.

Implementations§

Source§

impl ThreadBuilder

Source

pub fn new(name: String) -> Self

Starts a builder with default portable stack requirements.

Source

pub fn stack_size(self, stack_size: usize) -> Self

Selects the usable stack size in bytes.

Source

pub fn stack_alignment(self, stack_alignment: usize) -> Self

Selects the stack alignment in bytes.

Source

pub fn guard_size(self, guard_size: usize) -> Self

Requests an inaccessible stack guard area from the runtime.

Source

pub fn policy(self, policy: SchedulePolicy) -> Self

Selects the base scheduler policy.

Source

pub fn affinity(self, affinity: CpuSet) -> Self

Restricts placement to the supplied topology-sized CPU set.

Source

pub unsafe fn extension(self, extension: ThreadExtension) -> Self

Composes one OS-owned extension inside the portable thread wrapper.

§Safety

extension transfers unique callback-data ownership into this builder. The caller must not install another copy or invoke its drop callback. This builder must be spawned or dropped in ordinary task context.

Source

pub fn spawn<F>(self, entry: F) -> Result<KernelThreadHandle, TaskError>
where F: FnOnce() + Send + 'static,

Allocates, creates, and enqueues the configured thread.

§Errors

Returns scheduler validation or runtime resource errors from runtime allocation and scheduler admission.

Trait Implementations§

Source§

impl Debug for ThreadBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.