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

Associated Types

type Local: Sized + 'static[src]

The thread-local storage type.

Loading content...

Associated Constants

const COUNT: u16[src]

Number of threads in the pool.

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.

Loading content...

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]

Resumes each fiber attached to the thread.

Safety

The method is not reentrant.

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...