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

See also

Definition at line 221 of file thread.hpp.

#include <riot/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. More...
 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. More...
bool joinable () const noexcept
 Query if the thread is joinable. More...
void join ()
 Block until the thread finishes. More...
void detach ()
 Detaches a thread from its handle and allows it to execute independently. More...
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. More...

Constructor & Destructor Documentation

◆ thread()

template<class F , class... Args>
riot::thread::thread ( F &&  f,
Args &&...  args 
[in]fFunctor to run as a thread.
[in]argsArguments passed to the functor.

Definition at line 350 of file thread.hpp.

Member Function Documentation

◆ detach()

void riot::thread::detach ( )

The thread cleans up its resources when it finishes.

◆ hardware_concurrency()

static unsigned riot::thread::hardware_concurrency ( )

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

◆ join()

void riot::thread::join ( )

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

◆ joinable()

bool riot::thread::joinable ( ) const
true if the thread is joinable, false otherwise.

Definition at line 282 of file thread.hpp.

◆ swap()

void riot::thread::swap ( thread t)
[in,out]tThread to swap data with.

Definition at line 273 of file thread.hpp.

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