RTEMS 6.1-rc1
Public Types | Public Member Functions
rtems::thread::attributes Class Reference

Manage the attributes of a thread. More...

#include <thread.hpp>

Public Types

enum  sched_attr { sched_inherit , sched_explicit }
 
enum  sched_policy { sched_other , sched_fifo , sched_roundrobin , sched_sporadic }
 

Public Member Functions

 attributes ()
 
 attributes (const attributes &attr)
 
void set_name (const std::string &name)
 
void set_name (const char *name)
 
const std::string & get_name () const
 
void set_priority (int priority)
 
int get_priority () const
 
void set_stack_size (size_t size)
 
size_t get_stack_size () const
 
void set_scheduler (const std::string &scheduler)
 
void set_scheduler (const char *scheduler)
 
const std::string & get_scheduler ()
 
sched_attr get_scheduler_attr () const
 
void set_scheduler_policy (sched_policy policy)
 
sched_policy get_scheduler_policy () const
 
void commit ()
 
void update ()
 
attributesoperator= (const attributes &attr)
 
bool operator== (const attributes &attr) const
 

Detailed Description

Manage the attributes of a thread.

Member Enumeration Documentation

◆ sched_attr

The scheduler attribute.

Enumerator
sched_inherit 

Inherit the scheduler attributes from the creating thread.

sched_explicit 

Explicitly set the scheduler to these attributes.

◆ sched_policy

The scheduler policies.

Enumerator
sched_other 

Other scheduler policy

sched_fifo 

FIFO scheduler policy

sched_roundrobin 

Round robin scheduler policy

sched_sporadic 

Sporadic scheduler policy

Constructor & Destructor Documentation

◆ attributes()

rtems::thread::attributes::attributes ( )

Construct a thread attributes object with the current settings of the executing thread. The stack size is set to the configured minimum stack size.

Member Function Documentation

◆ commit()

void rtems::thread::attributes::commit ( )

Commit any changes to the executing thread.

Note
only the priority and attribute of a thread can be changed. The name and stack size are ignored.

◆ get_name()

const std::string & rtems::thread::attributes::get_name ( ) const

Get the name of the thread.

Return values
conststd::string& The name of the thread.

◆ get_priority()

int rtems::thread::attributes::get_priority ( ) const

Get the POSIX API priority of the thread.

Return values
intThe POSIX API thread priority.

◆ get_scheduler()

const std::string & rtems::thread::attributes::get_scheduler ( )

Get scheduler name.

◆ get_scheduler_attr()

attributes::sched_attr rtems::thread::attributes::get_scheduler_attr ( ) const

Get the attributes' scheduler attribute for the thread.

Returns
sched_attr The attributes' scheduler attribute

◆ get_scheduler_policy()

attributes::sched_policy rtems::thread::attributes::get_scheduler_policy ( ) const

Get the scheduler policy for the thread.

◆ get_stack_size()

size_t rtems::thread::attributes::get_stack_size ( ) const

Get the stack size.

Return values
size_tThe stack size in bytes.

◆ operator=()

attributes & rtems::thread::attributes::operator= ( const attributes attr)

Copy operator.

◆ operator==()

bool rtems::thread::attributes::operator== ( const attributes attr) const

The comparison operator does not check the name or stack size of a thread.

◆ set_name() [1/2]

void rtems::thread::attributes::set_name ( const char *  name)

Set the name of the thread. The thread is a classic API thread and the name is only 4 characters.

Parameters
nameThe name as a string.

◆ set_name() [2/2]

void rtems::thread::attributes::set_name ( const std::string &  name)

Set the name of the thread. The thread is a classic API thread and the name is only 4 characters.

Parameters
nameThe name as a string.

◆ set_priority()

void rtems::thread::attributes::set_priority ( int  priority)

Set the priority of the thread.

Parameters
priorityThe POSIX API priority of the thread.

◆ set_scheduler() [1/2]

void rtems::thread::attributes::set_scheduler ( const char *  scheduler)

Set the scheduler name. If not set no scheduler is set.

◆ set_scheduler() [2/2]

void rtems::thread::attributes::set_scheduler ( const std::string &  scheduler)

Set the scheduler name. If not set no scheduler is set.

@parrm scheduler The name of the scheduler.

◆ set_scheduler_policy()

void rtems::thread::attributes::set_scheduler_policy ( sched_policy  policy)

Set the scheduler policy for the thread. This call sets the scheduler attribute to sched_explicit.

Parameters
policyThe scheduler policy.

◆ set_stack_size()

void rtems::thread::attributes::set_stack_size ( size_t  size)

Set the stack size. If the size is less than the configured minimum the minimum value is used.

Parameters
sizeThe stack size in bytes.

◆ update()

void rtems::thread::attributes::update ( )

Update the attribute values from the executing thread. The attributes are updated from the current thread when constructed and the values returned are those held since then. If another thread changes the attributes of the current thread those changes will not be seen until this method is called. Except for the name and stack size any local changes made will lost then the update call is made.


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