Loading...
Searching...
No Matches
riot::thread Class Reference

C++11 compliant implementation of thread, however uses the time point from out chrono header instead of the specified one. More...

Detailed Description

C++11 compliant implementation of thread, however uses the time point from out chrono header instead of the specified one.

See also
std::thread

Definition at line 214 of file thread.hpp.

#include <thread.hpp>

Public Types

using id = thread_id
 The id is of type thread_id-.
 
using native_handle_type = kernel_pid_t
 The native handle type is the kernel_pid_t of RIOT.
 

Public Member Functions

 thread () noexcept
 Per default, an uninitialized thread is created.
 
template<class F , class... Args>
 thread (F &&f, Args &&... args)
 Create a thread from a functor and arguments for it.
 
 thread (const thread &)=delete
 Disallow copy constructor.
 
 thread (thread &&t) noexcept
 Move constructor.
 
threadoperator= (const thread &)=delete
 Disallow copy assignment operator.
 
threadoperator= (thread &&) noexcept
 Move assignment operator.
 
void swap (thread &t) noexcept
 Swap threads.
 
bool joinable () const noexcept
 Query if the thread is joinable.
 
void join ()
 Block until the thread finishes.
 
void detach ()
 Detaches a thread from its handle and allows it to execute independently.
 
id get_id () const noexcept
 Returns the id of a thread.
 
native_handle_type native_handle () noexcept
 Returns the native handle to a thread.
 

Static Public Member Functions

static unsigned hardware_concurrency () noexcept
 Returns the number of concurrent threads supported by the underlying hardware.
 

Member Typedef Documentation

◆ id

The id is of type thread_id-.

Definition at line 219 of file thread.hpp.

◆ native_handle_type

The native handle type is the kernel_pid_t of RIOT.

Definition at line 223 of file thread.hpp.

Constructor & Destructor Documentation

◆ thread() [1/3]

riot::thread::thread ( )
inlinenoexcept

Per default, an uninitialized thread is created.

Definition at line 228 of file thread.hpp.

◆ thread() [2/3]

template<class F , class... Args>
riot::thread::thread ( F &&  f,
Args &&...  args 
)
explicit

Create a thread from a functor and arguments for it.

Parameters
[in]fFunctor to run as a thread.
[in]argsArguments passed to the functor.

Definition at line 343 of file thread.hpp.

◆ thread() [3/3]

riot::thread::thread ( thread &&  t)
inlinenoexcept

Move constructor.

Definition at line 245 of file thread.hpp.

Member Function Documentation

◆ detach()

void riot::thread::detach ( )

Detaches a thread from its handle and allows it to execute independently.

The thread cleans up its resources when it finishes.

◆ get_id()

id riot::thread::get_id ( ) const
inlinenoexcept

Returns the id of a thread.

Definition at line 292 of file thread.hpp.

◆ hardware_concurrency()

static unsigned riot::thread::hardware_concurrency ( )
staticnoexcept

Returns the number of concurrent threads supported by the underlying hardware.

Since there is no RIOT API to query this information, the function always returns 1;

◆ join()

void riot::thread::join ( )

Block until the thread finishes.

Leads to an error if the thread is not joinable or a thread joins itself.

◆ joinable()

bool riot::thread::joinable ( ) const
inlinenoexcept

Query if the thread is joinable.

Returns
true if the thread is joinable, false otherwise.

Definition at line 275 of file thread.hpp.

◆ native_handle()

native_handle_type riot::thread::native_handle ( )
inlinenoexcept

Returns the native handle to a thread.

Definition at line 296 of file thread.hpp.

◆ operator=()

thread & riot::thread::operator= ( thread &&  other)
inlinenoexcept

Move assignment operator.

Definition at line 361 of file thread.hpp.

◆ swap()

void riot::thread::swap ( thread t)
inlinenoexcept

Swap threads.

Parameters
[in,out]tThread to swap data with.

Definition at line 266 of file thread.hpp.


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