Module origin::thread

source ·
Available on crate feature thread only.
Expand description

Thread startup and shutdown.

Why does this api look like thread::join(t) instead of t.join()? Either way could work, but free functions help emphasize that this API’s Thread differs from std::thread::Thread. It does not detach or free its resources on drop, and does not guarantee validity. That gives users more control when creating efficient higher-level abstractions like pthreads or std::thread::Thread.

Structs§

  • An opaque pointer to a thread.
  • A numerical thread identifier. pid_t—A non-zero Unix process ID.

Functions§

  • Registers a function to call when the current thread exits.
  • Creates a new thread.
  • Return a raw pointer to the data associated with the current thread.
  • Return the current thread id.
  • Return the TLS address for the given offset for the current thread.
  • Return the default guard size for new threads.
  • Return the default stack size for new threads.
  • Marks a thread as “detached”.
  • id
    Return the id of a thread, or None if the thread has exited.
  • join
    Waits for a thread to finish.
  • Return the current thread’s stack address (lowest address), size, and guard size.
  • Yield the current thread, encouraging other threads to run.