Struct std::thread::ThreadUnstable
[-]
[+]
[src]
pub struct Thread { // some fields omitted }
A handle to a thread.
Methods
impl Thread
fn spawn<T, F>(f: F) -> JoinGuard<T> where T: Send, F: FnOnce() -> T, F: Send
Spawn a new joinable thread, returning a JoinGuard
for it.
The join guard can be used to explicitly join the child thread (via
join
), returning Result<T>
, or it will implicitly join the child
upon being dropped. To detach the child, allowing it to outlive the
current thread, use detach
. See the module documentation for additional details.
fn current() -> Thread
Gets a handle to the thread that invokes it.
fn yield_now()
Cooperatively give up a timeslice to the OS scheduler.
fn panicking() -> bool
Determines whether the current thread is panicking.
fn park()
Block unless or until the current thread's token is made available (may wake spuriously).
See the module doc for more detail.
fn unpark(&self)
Atomically makes the handle's token available if it is not already.
See the module doc for more detail.
fn name(&self) -> Option<&str>
Get the thread's name.