The friendly Operating System for the Internet of Things
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
std::thread

Definition at line 220 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
 
 thread (thread &&t) noexcept
 Move constructor.
 
threadoperator= (const thread &)=delete
 
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

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

Definition at line 340 of file thread.hpp.

Member Function Documentation

void riot::thread::detach ( )

The thread cleans up its resources when it finishes.

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

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

void riot::thread::join ( )

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

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

Definition at line 272 of file thread.hpp.

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

Definition at line 263 of file thread.hpp.


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