std::thread::park - Rust
Description: API documentation for the Rust `park` fn in crate `std`.
Keywords: rust, rustlang, rust-lang, park

# Function std::thread::park 1.0.0 [−] [src]

    pub fn park()

Blocks unless or until the current thread's token is made available.

Every thread is equipped with some basic low-level blocking support, via the `park()` function and the `unpark()` method. These can be used as a more CPU-efficient implementation of a spinlock.

The API is typically used by acquiring a handle to the current thread, placing that handle in a shared data structure so that other threads can find it, and then parking (in a loop with a check for the token actually being acquired).

A call to `park` does not guarantee that the thread will remain parked forever, and callers should be prepared for this possibility.

See the module documentation for more detail.

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)