zephyr::sys::thread

Struct Thread

source
pub struct Thread { /* private fields */ }
Expand description

A single Zephyr thread.

This wraps a k_thread type within Rust. This value is returned from StaticThread::init_once and represents an initialized thread that hasn’t been started.

Implementations§

source§

impl Thread

source

pub fn set_priority(&mut self, priority: c_int)

Set the priority the thread will be created at.

source

pub fn set_options(&mut self, options: u32)

Set the value of the options passed to thread creation.

source

pub fn set_name(&mut self, name: &'static CStr)

Set a name for this thread.

Attempts to set the name of this thread, if Zephyr if configured to do so. Has no effect otherwise.

source

pub unsafe fn simple_spawn( self, child: k_thread_entry_t, p1: *mut c_void, p2: *mut c_void, p3: *mut c_void, )

Simple thread spawn. This is unsafe because of the raw values being used. This can be useful in systems without an allocator defined.

source

pub fn spawn<F: FnOnce() + Send + 'static>(self, child: F)

Spawn a thread, with a closure.

This requires allocation to be able to safely pass the closure to the other thread.

Auto Trait Implementations§

§

impl Freeze for Thread

§

impl RefUnwindSafe for Thread

§

impl !Send for Thread

§

impl !Sync for Thread

§

impl Unpin for Thread

§

impl UnwindSafe for Thread

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.