Trait drone_core::thr::Thread [−][src]
pub unsafe trait Thread: Sized + Sync + 'static { type Local: Sized + 'static; const COUNT: u16; fn pool() -> *const Self; fn current() -> *const AtomicU16; fn fib_chain(&self) -> &Chain; fn local_opaque(&self) -> &LocalOpaque<Self>; fn local() -> &'static Self::Local { ... } fn local_checked() -> Option<&'static Self::Local> { ... } unsafe fn resume(&self) { ... } unsafe fn call(thr_idx: u16, f: unsafe fn(_: &'static Self)) { ... } }
Basic thread.
Safety
Thread::poolmust point to an array withThread::COUNTnumber of elements.Thread::currentvalue must be zero-initialized.
Associated Types
Loading content...Associated Constants
Loading content...Required methods
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.
fn current() -> *const AtomicU16[src]
Returns a raw pointer to the current thread index storage.
fn fib_chain(&self) -> &Chain[src]
Returns a reference to the fiber chain.
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.
Provided methods
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.
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.
unsafe fn resume(&self)[src]
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_idxmust be less thanThread::COUNT.