rstd 0.1.0
Loading...
Searching...
No Matches
rstd::thread::builder::Builder Struct Referenceexport
module rstd

Thread factory, which can be used in order to configure the properties of a new thread. More...

Public Member Functions

auto name (String name) -> Builder &
 Sets the name of the thread-to-be.
 
auto stack_size (usize size) -> Builder &
 Sets the size of the stack for the new thread.
 
auto no_hooks () -> Builder &
 Disables running and inheriting thread spawn hooks.
 
template<typename F >
auto spawn (F &&f) -> io::Result< JoinHandle< mtp::invoke_result_t< F > > >
 Spawns a new thread by taking ownership of the Builder and calling f.
 

Static Public Member Functions

static auto make () -> Builder
 Creates a new Builder with default configuration.
 

Detailed Description

Thread factory, which can be used in order to configure the properties of a new thread.

Member Function Documentation

◆ name()

auto rstd::thread::builder::Builder::name ( String name) -> Builder&
inline

Sets the name of the thread-to-be.

Parameters
nameThe thread name for identification in panic messages.

◆ spawn()

template<typename F >
auto rstd::thread::builder::Builder::spawn ( F && f) -> io::Result<JoinHandle<mtp::invoke_result_t<F>>>
inline

Spawns a new thread by taking ownership of the Builder and calling f.

Template Parameters
FThe callable type for the thread entry point.
Parameters
fThe closure or function to execute in the new thread.
Returns
A JoinHandle on success, or an I/O error on failure.

◆ stack_size()

auto rstd::thread::builder::Builder::stack_size ( usize size) -> Builder&
inline

Sets the size of the stack for the new thread.

Parameters
sizeThe stack size in bytes.

The documentation for this struct was generated from the following file: