RTEMS 6.1-rc1
Data Structures | Public Types | Public Member Functions | Friends
rtems::thread::thread Class Reference

Create a thread with thread attributes. More...

#include <thread.hpp>

Data Structures

class  id
 

Public Types

template<typename A , class DecayA = typename std::decay<A>::type>
using enable_if_attributes = typename std::enable_if< std::is_same< DecayA, attributes >::value >::type
 

Public Member Functions

 thread () noexcept=default
 
template<typename F , typename... Args>
 thread (F &&func, Args &&... args)
 
template<typename A , typename F , typename ... Args, class = enable_if_attributes<A>>
 thread (A &&attr, F &&func, Args &&... args)
 
threadoperator= (thread &&thread_)
 
void swap (thread &thread_) noexcept
 
bool joinable () const noexcept
 
void join ()
 
void detach ()
 
 thread (thread &)=delete
 
 thread (const thread &)=delete
 
 thread (const thread &&)=delete
 
threadoperator= (const thread &)=delete
 
std::thread::id get_id () const noexcept
 

Friends

void * thread_generic_entry (void *arg)
 

Detailed Description

Create a thread with thread attributes.

Create a thread optionally with thread attributes. The usage of this class follows the C++ standard for std::thread. The standard support for creating a thread does not let you control the attributes of a thread and control is important in embedded real-time applications. This class lets you control a thread attributes and use the extensive an excellent thread support the C++ standard provides.

There is no indication attribute support for threads will be added to the C++ standard and what it will look like. The support provided here is designed to make as little impact on a code base as possible. While the attributes supported are specific to RTEMS they are common to all embedded operating systems.

The support provided here is specific to GCC due to the use of some non-standard interfaces to get the indices of the template argument pack in new thread's context. A standards only solution would be preferred.

Member Typedef Documentation

◆ enable_if_attributes

template<typename A , class DecayA = typename std::decay<A>::type>
using rtems::thread::thread::enable_if_attributes = typename std::enable_if <std::is_same<DecayA, attributes>::value>::type

Template check to see if the first argument of a thread is a set of attributes.

Constructor & Destructor Documentation

◆ thread() [1/3]

rtems::thread::thread::thread ( )
defaultnoexcept

The default thread constructions.

◆ thread() [2/3]

template<typename F , typename... Args>
rtems::thread::thread::thread ( F &&  func,
Args &&...  args 
)
explicit

The std::thread equivalent constructor. The attributes will be the same as the executing thread with a default thread name and the configured minimum stack size.

◆ thread() [3/3]

template<typename A , typename F , typename ... Args, class = enable_if_attributes<A>>
rtems::thread::thread::thread ( A &&  attr,
F &&  func,
Args &&...  args 
)
inlineexplicit

Create a thread with the provided attributes. The entry point and optional arguments are the same as std::thread.

Member Function Documentation

◆ operator=()

thread & rtems::thread::thread::operator= ( thread &&  thread_)

Move the thread id to this instance.


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