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.

§Safety

Safe use follows similar requirements to using this safely from within C code. Passing Rust values through this interface is difficult to get right, and it is generally recommended to use spawn.

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.