Skip to main content

ThreadBuilder

Struct ThreadBuilder 

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

Configuration shared by kernel and user execution contexts.

Implementations§

Source§

impl ThreadBuilder

Source

pub fn new(name: String) -> Self

Starts a thread configuration with portable stack requirements.

Source

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

Sets the usable stack size in bytes.

Source

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

Sets stack alignment in bytes.

Source

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

Sets the inaccessible guard size in bytes.

Source

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

Sets the scheduling policy.

Source

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

Restricts initial and subsequent placement.

Source

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

Transfers an OS extension directly to the scheduler record.

Source

pub fn prepare( self, entry: impl FnOnce() + Send + 'static, ) -> Result<PreparedThread, TaskError>

Creates a new, non-runnable kernel thread.

Source

pub fn spawn( self, entry: impl FnOnce() + Send + 'static, ) -> Result<ThreadHandle, TaskError>

Creates and activates a kernel thread without an external publication transaction.

Source

pub unsafe fn prepare_with( self, entry: impl FnOnce() + Send + 'static, resources: impl FnOnce(StackRequest, unsafe extern "C" fn() -> !) -> Result<ThreadResources, TaskError>, ) -> Result<PreparedThread, TaskError>

Creates a thread using an architecture-specific resource constructor.

§Safety

The constructor must install the supplied trampoline as its initial entry, return uniquely owned resources satisfying ThreadResources::new, and release every partial allocation on failure. It must not publish the context.

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.