pub struct ThreadBuilder { /* private fields */ }Expand description
Configuration shared by kernel and user execution contexts.
Implementations§
Source§impl ThreadBuilder
impl ThreadBuilder
Sourcepub fn new(name: String) -> Self
pub fn new(name: String) -> Self
Starts a thread configuration with portable stack requirements.
Sourcepub fn stack_size(self, size: usize) -> Self
pub fn stack_size(self, size: usize) -> Self
Sets the usable stack size in bytes.
Sourcepub fn stack_alignment(self, alignment: usize) -> Self
pub fn stack_alignment(self, alignment: usize) -> Self
Sets stack alignment in bytes.
Sourcepub fn guard_size(self, size: usize) -> Self
pub fn guard_size(self, size: usize) -> Self
Sets the inaccessible guard size in bytes.
Sourcepub fn policy(self, policy: SchedulePolicy) -> Self
pub fn policy(self, policy: SchedulePolicy) -> Self
Sets the scheduling policy.
Sourcepub fn extension(self, extension: ThreadExtension) -> Self
pub fn extension(self, extension: ThreadExtension) -> Self
Transfers an OS extension directly to the scheduler record.
Sourcepub fn prepare(
self,
entry: impl FnOnce() + Send + 'static,
) -> Result<PreparedThread, TaskError>
pub fn prepare( self, entry: impl FnOnce() + Send + 'static, ) -> Result<PreparedThread, TaskError>
Creates a new, non-runnable kernel thread.
Sourcepub fn spawn(
self,
entry: impl FnOnce() + Send + 'static,
) -> Result<ThreadHandle, TaskError>
pub fn spawn( self, entry: impl FnOnce() + Send + 'static, ) -> Result<ThreadHandle, TaskError>
Creates and activates a kernel thread without an external publication transaction.
Sourcepub unsafe fn prepare_with(
self,
entry: impl FnOnce() + Send + 'static,
resources: impl FnOnce(StackRequest, unsafe extern "C" fn() -> !) -> Result<ThreadResources, TaskError>,
) -> Result<PreparedThread, TaskError>
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§
Auto Trait Implementations§
impl Freeze for ThreadBuilder
impl RefUnwindSafe for ThreadBuilder
impl Send for ThreadBuilder
impl Sync for ThreadBuilder
impl Unpin for ThreadBuilder
impl UnsafeUnpin for ThreadBuilder
impl UnwindSafe for ThreadBuilder
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