Trait lock_api::GetThreadId[][src]

pub unsafe trait GetThreadId {
    const INIT: Self;

    fn nonzero_thread_id(&self) -> NonZeroUsize;
}

Helper trait which returns a non-zero thread ID.

The simplest way to implement this trait is to return the address of a thread-local variable.

Safety

Implementations of this trait must ensure that no two active threads share the same thread ID. However the ID of a thread that has exited can be re-used since that thread is no longer active.

Associated Constants

const INIT: Self[src]

Initial value.

Loading content...

Required methods

fn nonzero_thread_id(&self) -> NonZeroUsize[src]

Returns a non-zero thread ID which identifies the current thread of execution.

Loading content...

Implementors

Loading content...