Trait drone_cortexm::thr::Thread[][src]

pub unsafe trait Thread: 'static + Sync {
    type Local: 'static + Sized;

    pub const COUNT: u16;

    pub fn pool() -> *const Self;
pub fn current() -> *const AtomicU16;
pub fn fib_chain(&self) -> &Chain;
pub fn local_opaque(&self) -> &LocalOpaque<Self>; pub fn local() -> &'static Self::Local { ... }
pub fn local_checked() -> Option<&'static Self::Local> { ... }
pub unsafe fn resume(&self) { ... }
pub unsafe fn call(thr_idx: u16, f: unsafe fn(&'static Self)) { ... } }

Basic thread.

Safety

Associated Types

type Local: 'static + Sized[src]

The thread-local storage type.

Loading content...

Associated Constants

pub const COUNT: u16[src]

Number of threads in the pool.

Loading content...

Required methods

pub fn pool() -> *const Self[src]

Returns a raw pointer to the thread pool.

To obtain a safe reference to a thread object, use ThrToken::to_thr method on the corresponding thread token instance.

pub fn current() -> *const AtomicU16[src]

Returns a raw pointer to the current thread index storage.

pub fn fib_chain(&self) -> &Chain[src]

Returns a reference to the fiber chain.

pub fn local_opaque(&self) -> &LocalOpaque<Self>[src]

Returns a reference to the opaque thread-local storage.

Non-opaque thread-local storage can be obtained through Thread::local function.

Loading content...

Provided methods

pub fn local() -> &'static Self::Local[src]

Returns a reference to the thread-local storage for the current thread.

The contents of this object can be customized with thr::pool! macro. See the module-level documentation for details.

Panics

This function will panic if called outside of this thread pool.

pub fn local_checked() -> Option<&'static Self::Local>[src]

Returns a reference to the thread-local storage for the current thread.

If called outside of this thread pool, returns None.

The contents of this object can be customized with thr::pool! macro. See the module-level documentation for details.

pub unsafe fn resume(&self)[src]

Resumes each fiber attached to the thread.

Safety

The method is not reentrant.

pub unsafe fn call(thr_idx: u16, f: unsafe fn(&'static Self))[src]

Runs the function f inside the thread number thr_idx.

Safety

  • The function is not reentrant.
  • thr_idx must be less than Thread::COUNT.
Loading content...

Implementors

Loading content...